16

My ethernet-based network connection doesn't stay up consistently. I'm running a ping against the gateway and it will:

  • Work for a minute
  • Freeze, time out, or give multi-second response times
  • Repeat

If it's stuck and I disable/enable networking through the network manager applet everything will work fine again for a minute. After 280 packets transmitted I'm getting 41% packet loss. I've tried a different cable and connection to the gateway but this had no effect. The distance to the gateway is just about 3 feet.

Seems to work fine if I switch over to Windows, but Ubuntu is my main OS and I can't even use it right now as I depend on the network.

My setup...

  • OS: Ubuntu 11.04, dual-booting Windows 7
  • Mobo: Gigabyte Z68X-UD4-B3
  • CPU: Intel Core i7 2600K

Edit

A little clarification... Network Manager is still showing me as connected, but I am unable to reach to gateway or anything beyond. At no point does NM suggest the connection is lost and calling ifconfig shows that I still have an IP address.

I tried connecting to a different gateway with a different cable and the same problem arises.

As requested:

lspci | grep -i eth
07:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 06)

dmesg | tail -f
[   14.024709] EXT4-fs (sda5): re-mounted. Opts: errors=remount-ro,commit=0
[   14.026443] EXT4-fs (sda7): re-mounted. Opts: commit=0
[   14.176101] hda-intel: IRQ timing workaround is activated for card #2. Suggest a bigger bdl_pos_adj.
[   23.917731] eth0: no IPv6 routers present
[  726.109697] r8169 0000:07:00.0: eth0: link up
[  733.169494] r8169 0000:07:00.0: eth0: link up
[  753.930119] r8169 0000:07:00.0: eth0: link up
[  880.787332] r8169 0000:07:00.0: eth0: link up
[ 1159.161283] r8169 0000:07:00.0: eth0: link up
[ 1406.623550] r8169 0000:07:00.0: eth0: link up

Edit

@roland-taylor: Network is always available under Windows. Pings do not timeout, applications do not complain of no network availability, large downloads are not interrupted or slowed.

Lekensteyn
  • 178,446
Sean Hill
  • 163

6 Answers6

13

Download the official realtek driver.

http://www.realtek.com/downloads/downloadsView.aspx?Langid=1&PNid=5&PFid=5&Level=5&Conn=4&DownTypeID=3&GetDown=false#2

Then remove the r8169 module from the linux kernel.

# rmmod r8169

<Quick install with proper kernel settings>
Unpack the tarball :
# tar vjxf r8168-8.aaa.bb.tar.bz2
Change to the directory:
# cd r8168-8.aaa.bb
If you are running the target kernel, then you should be able to do :
# ./autorun.sh (as root or with sudo)
You can check whether the driver is loaded by using following commands.
# lsmod | grep r8168
# ifconfig -a
If there is a device name, ethX, shown on the monitor, the linux
driver is loaded. Then, you can use the following command to activate
the ethX.
# ifconfig ethX up

Finally, blacklist the r8169 driver add the following to /etc/modprobe.d/blacklist.conf:

#blacklist r8169 driver
blacklist r8169

I found it at http://www.rvdavid.net/how-to-get-gigabit-speeds-from-rtl81118168b-pci-express-gigabit-ethernet-controller-on-ubuntu-linux/ and it works. Now it's all good with net speed.

Pro Backup
  • 3,248
dude
  • 146
8

Just so I can find this next time my SSD blows up. Here are instructions for removing the broken r8169 and inserting r8168 on Ubuntu w/Linux Kernel 3.x.

Kernel 3.x

  • Download r8168
  • Apply this patch if it is still marked unresolved.
  • STOP: If you plan to use DKMS, skip to the DKMS section now.
  • Run sudo ./autogen.sh, it will build the module, remove the old one (blacklist it if you want) and install r8168.ko to /lib/modules/'uname -r'/drivers/net/.

DKMS

DKMS will build and install the module upon new kernel installs. You will also need to blacklist the old module.

Blacklist the old module if you haven't already.

echo 'rmmod r8169' | sudo tee /etc/modprobe.d/blacklist.conf

Install DKMS, and gcc.

sudo apt-get install dkms gcc

Copy the module source files to a persistent location, so you don't accidently remove them later.

sudo cp -R r8168-8.025.00 /usr/src

echo 'PACKAGE_NAME=r8168
PACKAGE_VERSION=8.025.00
MAKE[0]="make"
BUILT_MODULE_NAME[0]=r8168
BUILT_MODULE_LOCATION[0]="src/"
DEST_MODULE_LOCATION[0]="/kernel/updates/dkms"
AUTOINSTALL="YES"' | sudo tee /usr/src/r8168-8.025.00/dkms.conf

Then run,

dkms add -m r8168 -v 8.025.00
dkms build -m r8168 -v 8.025.00
dkms install -m r8168 -v 8.019.00
sudo update-initramfs -u
Drew
  • 370
2

I had a similar problem and I found a solution.

see https://bugs.launchpad.net/ubuntu/+source/linux/+bug/889527

qwertz
  • 21
0

that may be usefull

you may experience the issues with the r8169 driver if you dual boot Windows on some systems. Windows by defaults disables the NIC at Windows shutdown time in order to disable Wake-On-Lan, and this NIC will remain disabled until the next time Windows turns it on. The r8169 driver in the kernel does not know how to turn the NIC on from this disabled state; therefore, the device will not respond, even if the driver loads and reports that the device is up. To work around this problem, simply enable the feature "Wake-on-lan after shutdown." You can set this options through Windows' device manager.

Edit: Problem with dual-booting with Windows exist also in 2.6.19.5 and 2.6.20.8 kernel, so it is safe to assume that it will concern all 2.6 kernels until the kernel developers update the drivers for RTL8168 to the version that will be able to turn on the NIC from disabled state

dude
  • 146
0

and one more thing - to make changes with driver constant and prevent starting r8169 again after reboot, i used this:

http://ubuntuforums.org/showthread.php?t=723569

dude
  • 146
0

Errata corrige:

echo 'blacklist r8169' | sudo tee /etc/modprobe.d/blacklist-r8169.conf
dkms add -m r8168 -v 8.025.00
dkms build -m r8168 -v 8.025.00
dkms install -m r8168 -v 8.025.00
sudo update-initramfs -u
Nathan Osman
  • 32,495
sccplg
  • 1