slow network connection on Ubuntu

I recently got a new PC with ASUS mainboard. I installed both Windows and Ubuntu 11.10. Everything was fine except that on Ubuntu, the connection was slow, quite often disconnected, downloads from the Internet were halted without being completed or they were corrupted, and in general not performing well.

It couldn’t be the Internet connection; since, this is my PC in university connected to the Internet through a wired connection. But more importantly, once I am logged on Windows 7 64bit, the Internet and network works just fine. So, it couldn’t be a malfunction hardware either. That was our beloved Ubuntu.

So, the first step was to check if the proper drivers are loaded using the following command:

lspci -v

I scrolled through the output and found my ethernet controler. it was:

“Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B”

then I checked what kernel driver is used for that

Kernel driver in use: r8169

So, it’s clear why it was behaving funny. Wrong driver was in use. Here is how to fix it.

First you need to download the latest driver. You can get the latest driver on Google Code project (click here). At the time of this writing the latest driver was ” r8168-8.032.00.tar.bz2“.

Unpack this file, and type:

sudo make clean modules install

Now you need to let the kernel know about this new driver. Just type:

sudo depmod -a

followed by

sudo insmod r8168.ko

r8168.ko is in the src folder of the driver that you just unpacked and compiled. insmod as its name suggests inserts a module into the running kernel. Obviously you need to have root access for all commands and if you do not have installed the compilers do it so by “sudo apt-get install build-essentials”

Now to make this driver available at the boot time you need to issue the following command:

mkinitramfs -o /boot/initrd.img-`uname -r` `uname -r`

also add the r8168 module to /etc/modules. (Just add one line at the end by typing r8168).

Also to make sure that the r8169 is not loaded, add “blacklist r8169” to /etc/modprobe.d/blacklist.conf.

You should be good to go.

This entry was posted in Tech Tips. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s