# KC3: Networking

## TheCoop

Navigation:  [Kernel Compilation] [Table of Contents]

KC3: Networking worked during installation, but now that I compiled my own kernel, it doesn't work anymore. What's wrong?

Firstly, you need to make sure you have the correct kernel modules compiled into the kernel (found in Device Drivers -> Network Device Support -> Ethernet xxxMbit). You can choose which one you have using the output of lspci and the kernel help with each network driver. For instance, my lspci output is:

```
...

00:10.0 PCI bridge: nVidia Corporation MCP51 PCI Bridge (rev a2)

00:10.1 Audio device: nVidia Corporation MCP51 High Definition Audio (rev a2)

00:14.0 Bridge: nVidia Corporation MCP51 Ethernet Controller (rev a3)

00:18.0 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] HyperTransport Technology Configuration

...
```

This shows I have the nvidia network controller (00:14.0), so I need to select the nForce network driver in the 10/100Mbit menu. It is usually a good idea to compile network devices into the kernel, rather than as a module. This stops you messing around with hotplug & modules.autoload. If you don't know which network driver out of several yours might apply to, compile all the possibilities as modules, then load them one by one (you dont need to reboot for this, if the kernel version you are running is the same as you are compiling the modules for), having a look at the output of 'dmesg|tail' to see which one finds the network controller. That is then the one you need to select to be compiled into the kernel (you can deselect all the others that didn't work). You can also check to see if a new network device appears in the output of 'ifconfig -a'

If you know you have the correct driver compiled in, and your network uses dhcp you don't need to do any extra configuration - you should already have a dhcp client installed (dhcpcd), so simply run '/etc/init.d/net.eth0 start'. If your network card is a different number (eg eth1) create the net.eth1 script as follows:

```
cd /etc/init.d

ln -s net.eth0 net.eth1
```

If dhcpcd doesnt work, you can run it directly in debug mode to see where it is going wrong with the following:

```
dhcpcd -d ethx
```

If your network uses static addressing, you need to create the /etc/conf.d/net file with something like the following in it:

```
config_eth0=( "192.168.0.2 netmask 255.255.255.0 broadcast 192.168.0.255" )
```

or

```
config_eth0=( "192.168.0.2 netmask 255.255.255.0" )
```

depending on your network setup. Then bring it up with '/etc/init.d/net.eth0 start'

Hopefully this should get you a working network connection, so you can then add net.eth0 to the startup script to have networking brought up on boot: rc-update add net.eth0 boot (or net.eth1 as needed)Last edited by TheCoop on Sun Jan 14, 2007 2:30 pm; edited 1 time in total

----------

## rac

Post comments on this FAQ to [FAQF] KC3: Networking.

----------

## pjp

From the old FAQ:

It is generally easier in the long run to compile drivers for network cards directly into the kernel, rather than as modules. Make sure the driver for your network card is selected as [*] when you configured the kernel. Also make sure you mounted the partition containing the /boot directory when you copied your kernel to it; otherwise your changes will not take effect.

----------

