UPDATE: Stock kernel driver is fixed in Ubuntu 12.04 Precise Pangoling. Current kernel is 3.2.0-17-generic and everything has been working for quite some time.
If you are using Ubuntu (and probably other distributions too) and you have an on board Realtek RTL8168/8111E PCI Express network adapter you might find your network not working as it should. Slow connections or no connection at all and your logs full of messages like these:
Oct 02 09:13:25 machine kernel: r8169 0000:04:00.0: eth0: link up Oct 02 12:45:17 machine kernel: r8169 0000:04:00.0: eth0: link up Oct 02 12:45:20 machine kernel: r8169 0000:04:00.0: eth0: link up Oct 02 13:15:12 machine kernel: r8169 0000:04:00.0: eth0: link up Oct 02 13:15:13 machine kernel: r8169 0000:04:00.0: eth0: link up Oct 02 13:22:13 machine kernel: r8169 0000:04:00.0: eth0: link up
Read on if you want to know why this happens and how to solve the problem.
Driver that is included in vanilla Linux kernel is actually a driver for a different network adapter, but works with 8111E too. Sort of works. Realtek made new official driver that fixes the problem, but disables the old driver. Which could be a problem for you if you have RTL8169/8110 and RTL8168/81111.
First you will need the latest driver for your network adapter. Get it here. You will have to extract it and compile it. Current version is 8.025.00.
$ tar -xvjf r8168-8.025.00.tar.bz2 $ cd r8168-8.025.00 $ make modules
If you are running Ubuntu 11.10 Oneiric Ocelot then you can ignore the README file and autorun.sh script. The script is broken and the information in the README is obsolete. For other distributions and kernels autorun.sh might work. When make is complete you will have to get rid of the old module and replace it with the new one. Do this, while you’re still in the r8168-8.025.00 directory.
$ cd src $ sudo cp r8168.ko /lib/modules/`uname -r`/kernel/drivers/net/ $ sudo mv /lib/modules/`uname -r`/kernel/drivers/net/r8169.ko /lib/modules/`uname -r`/kernel/drivers/net/r8169.ko.old $ sudo depmod -a
Now, all you need to do is to take care that the driver will load on boot.
$ sudo echo "r8168" >> /etc/modules
Wouldn’t it be wise to test if the new driver is working at all, before you reboot? Easier than eating pancakes!
$ sudo modprobe -r r8169 # At this point your network will stop working $ sudo modprobe r8168 # And now network manager should pick up the new connection
Oh, and if you are annoyed that now your network interface is eth1 instead of eth0 as it used to be, remove the two lines from /etc/udev/rules.d/70-persistent-net.rules that end with NAME=”eth0″ and NAME=”eth1″.
- I wasn’t able to test this, the new driver might support other network adapter too. [↩]