# [SOLVED] Intermittent ethernet problems w/Realtek 8111/8168b

## bLanark

Hi

I have a new machine, 3.0.6 kernel, network card is (from lspci)

```
07:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 06) 
```

I built the kernel with 

```
CONFIG_R8169=y
```

But I get problems with connections stalling. So, an ssh session might just lock up, or a browser download snag, and when playing secondlife I get 

dumpResendCountAndReset: Circuit: 216.82.42.115:13001 resent 17 packets

and then thrown out of the game. 

Does anyone have any idea how to diagnose my problem? 

I built the machine at home, then moved it to work, and I have the same problem both places, the only thing in common is the ethernet cable, which I will replace next week, but has worked OK in the past. (Yeah, I know they get pulled, twisted, snagged and stood on, past performance is no indication of future performance, as the financial advisors say while they take your money and invest it "wisely.")

So, are there any tools I can use? 

ifconfig shows no errors/dropped packets.

```

eth0      Link encap:Ethernet  HWaddr 50:e5:49:c3:6b:45  

          inet addr:192.168.1.2  Bcast:192.168.1.255  Mask:255.255.255.0

          inet6 addr: fe80::52e5:49ff:fec3:6b45/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:387372 errors:0 dropped:0 overruns:0 frame:0

          TX packets:296597 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000 

          RX bytes:476667904 (454.5 MiB)  TX bytes:25310723 (24.1 MiB)

          Interrupt:43 Base address:0xc000 

```

and from dmsg:

```

[    0.484372] microcode: Microcode Update Driver: v2.00 <tigran@aivazian.fsnet.co.uk>, Peter Oruba

[    0.484714] audit: initializing netlink socket (disabled)

[    0.505012] SELinux:  Registering netfilter hooks

[    1.200675] r8169 Gigabit Ethernet driver 2.3LK-NAPI loaded

[    1.202799] r8169 0000:07:00.0: (unregistered net_device): unknown MAC, using family default

[    1.204062] r8169 0000:07:00.0: eth0: RTL8168b/8111b at 0xffffc90000c7c000, 50:e5:49:c3:6b:45, XID 0c900800 IRQ 43

[    1.205144] console [netcon0] enabled

[    1.206176] netconsole: network logging started

[    2.416723] ctnetlink v0.93: registering with nfnetlink.

[    2.420138] Initializing XFRM netlink socket

[   11.363736] r8169 0000:07:00.0: eth0: link down

[   11.363776] r8169 0000:07:00.0: eth0: link down

[   11.364090] ADDRCONF(NETDEV_UP): eth0: link is not ready

[   13.025475] r8169 0000:07:00.0: eth0: link up

[   13.025876] ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready

[   23.974025] eth0: no IPv6 routers present

```

But this is driving me crazy! I can't even clone a mercurial repository as the download stalls. Web browser downloads via http seem more reliable, perhaps they build in some additional retry logic. 

Your help would be appreciated!

----------

## chiefbag

Had this same issue using Ubuntu with this card.

You will need to download the the drivers from the Realtek site and complie them.

Here is what I did on the Ubuntu system, should be more or less the same with gentoo.

Not sure will it work with 3. kernel

Download drivers

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

Select "LINUX driver for kernel 2.6.x and 2.4.x (Support x86 and x64)"

unpack the file 

```
tar vjxf r8168-8.027.00.tar.bz2
```

execute

```
./autorun.sh
```

vi /etc/modprobe.d/blacklist.confblacklist 

```
r8169
```

For gentoo I think you need to load the module here like so

vi /etc/conf.d/modules

```
modules="r8168"
```

[EDIT] 

Note to manually load the module just do the following.

```
modprobe r8168
```

BTW kernel version was (2.6.32-37-generic)

----------

## bLanark

Thanks for your reply, chiefbag, I will attempt to get the drivers working with my 3.0.6 later kernel - just because it has taken me so much time to get a fb + proprietary nvidia drivers + all the other stuff sorted, I'd hate to waste another day and 20 kernel rebuilds if avoidable, and I expect that I'd have to start my kernel config from start if I went back a version or two, or spend a merry time diffing the .config files. 

BTW, My main server was built in 2005, runs a 2.6.13 kernel, and is solid as a rock - no need to upgrade. In fact, it still uses udev, so I'm definitely *not* upgrading 'cos that will hurt badly. I'm so old in the tooth, I still find myself typing "esearch" instead of "eix" when trying to locate packages.

----------

## Hu

 *bLanark wrote:*   

> BTW, My main server was built in 2005, runs a 2.6.13 kernel, and is solid as a rock - no need to upgrade.

 Do you mean that it is running that kernel now?  If so, I hope no untrustred users are allowed to interact with it, including via any services it exposes to the network.

----------

## SDNick484

I've had issues with that NIC as well, but the newer kernel drivers have gotten much better over the years.  I also found that card to be very picky about cables and actually had to use a short CAT6 if I wanted to get gigabit.

----------

## bLanark

 *Hu wrote:*   

>  *bLanark wrote:*   BTW, My main server was built in 2005, runs a 2.6.13 kernel, and is solid as a rock - no need to upgrade. Do you mean that it is running that kernel now?  If so, I hope no untrustred users are allowed to interact with it, including via any services it exposes to the network.

 

Thanks for the heads-up. 

Don't worry, it's [the old server] only for use by my family; and 95% protected by a hardware firewall upstream. To be honest I think the FUD about local-priv exploits have to be taken with a pinch of salt; if you're running RHEL in a banking environment then you need to be cautious, but the average gentoo user won't give public accounts to those he doesn't trust. 

I'm far more wary about the edge-visible software I run (http; https; smtp; ssh)  Especially any web software, E.g. Wordpress.

----------

## Ant P.

The kernel's networking stack is "edge-visible software" too.

----------

## Hu

Local privilege escalation exploits can often be combined with a remote-code-execution vulnerability in edge-visible software.

----------

## zsitvaij

The r8168 driver is in portage and up to date, no need to manually compile anything: http://packages.gentoo.org/package/net-misc/r8168

----------

## bLanark

It's in portage - that's great. I will apply it later today, and then update this topic.

Cheers!

----------

## bLanark

Fixed, thanks very much!

(I should add that taking the old card out of the kernel .config and running make to build a new kernel was not enough, I had to perform a make clean before it really disappeared.)

A.

----------

## Joseph_sys

 *bLanark wrote:*   

> Fixed, thanks very much!
> 
> (I should add that taking the old card out of the kernel .config and running make to build a new kernel was not enough, I had to perform a make clean before it really disappeared.)
> 
> A.

 

What "revision" is the new driver?

I'm running kernel-3.1.5-gentoo with:

Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 06) 

but still losing connection.

I have the driver build into the kernel.  Do I need to compile it as module and load the new one: net-misc/r8168-8.027.00

----------

## bLanark

 *Joseph_sys wrote:*   

> 
> 
> What "revision" is the new driver?
> 
> I'm running kernel-3.1.5-gentoo with:
> ...

 

Take the 8169 driver out of the kernel, do a make clean and build a new kernel, and install as usual. 

Then, emerge net-misc/r8168 (it's ~amd64, but works fine for me) - you need to re-emerge this every time you move to a new kernel version, I think, and it won't hurt to do so. Then, add r8168 to your modules autoload (wherever it is, I have always built stuff like this into the kernel in the past, so I don't know off by heart, and the machine is not in front of me at the moment)

I can give you more detail tomorrow (please reply if you need me to do this) but the 8169 (wrong) and 8168 (correct) drivers give different messages when the card is detected. So that's how you know you've got the correct one (or not).

It works fine, I had no dropouts today at all. 

If you reply, then I'll get a topic reply email and will be use this a cue to respond tomorrow, when I'm in front of the machine (I'm working on somewhere between UCT and CET at the moment, so it's down-time now.)

Cheers,

bL

----------

## Joseph_sys

Thanks, please post the detail tomorrow.

I think normally one need to build the network card as a module, emerge new driver, in this case: emerge net-misc/r8168 (~amd64)

and add to: /etc/conf.d/modules

```
modules="r8168"
```

I like to build all drivers into the kerel as well, less problems.

----------

## Joseph_sys

I've emerge the driver from portage, net-misc/r8168-8.026.00  

disable the one in the kernel but the computer network still hangs up / connection lost (the box needs to be restarted).

Though, the one in portage: net-misc/r8168-8.026.00 

is the same one as the one in newest kernel (rev 06):

```
Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller [10ec:8168] (rev 06)
```

So it make no difference if one is using kernel driver or the one from portage.

I think it is time to dump the Realtek, they seems to me just buggy piece of crap :-/

----------

## bLanark

 *Joseph_sys wrote:*   

> I've emerge the driver from portage, net-misc/r8168-8.026.00  
> 
> disable the one in the kernel but the computer network still hangs up / connection lost (the box needs to be restarted).
> 
> Though, the one in portage: net-misc/r8168-8.026.00 
> ...

 

You need to see this (in dmesg and/or /var/log/messages): 

```
Jan  9 13:13:58 acrux kernel: [    5.480567] r8168  Copyright (C) 2011  Realtek NIC software team <nicfae@realtek.com> 
```

when the module is loaded. I didn't see this the first time I tried to use the module; the old driver was still in the kernel despite being configured out, but this was cleared by a make clean in the kernel directory. 

I put the module name in the /etc/conf.d/modules file in a line. 

```
modules="nvidia r8168"
```

I agree that having to use a module is not optimal (insert smiley of your choice), in the past I've had everything in the kernel. 

This wasn't my first choice of motherboards, but it does appear to work well for me now. 

Good Luck!

----------

## Joseph_sys

 *bLanark wrote:*   

> 
> 
> You need to see this (in dmesg and/or /var/log/messages): 
> 
> ```
> ...

 

That is my problem I don't see anything "Realtek" in dmesg and/or /var/log/messages

I did "make clean" rebuild the kernel and module but the Realtek driver does not obtain IP address at all.

That is the end of "Realtek" for any of my future PC's.

----------

