# Realtek RTL8111/8168B initialisation problem



## rrichard (Feb 9, 2014)

I'm running FreeBSD 10. During install my network card was detected and I chose to use DHCP but nothing was picked up with DHCP, it didn't get an IP address and the namesever fields were left empty.
Booting the system up I see DHCP REQUEST / DISCOVER messages until it eventually gives up or I press CTRL C.
I tried to set the interface up manually `ifconfig re0 inet 192.168.0.6 netmask 255.255.255.0; route add default 192.168.0.1` but to no avail, ping fails and it just seems as though there is no link.
Eventually I discovered that if I took the interface down `ifconfig re0 down` and then bring it back up `ifconfig re0 up` it quickly gets setup with DHCP.
I've tried GNU/Linux and Windows out on this PC and didn't have this issue, so I don't think this is a problem with the interface itself or my modem/router's dhcp server.
Can anyone shed any light on how I might fix this issue?

`pciconf` output is

```
re0@pci0:1:0:0: class=0x020000 card=0x77211462 chip=0x816810ec rev=0x06 hdr=0x00
    vendor     = 'Realtek Semiconductor Co., Ltd.'
    device     = 'RTL8111/8168B PCI Express Gigabit Ethernet controller'
```


----------



## trh411 (Feb 9, 2014)

Since networking was not set up during installation, I'm guessing you have no nameserver defined in /etc/resolve.conf. I'm also guessing you are missing ifconfig_re0="DHCP" in your /etc/rc.conf. So, please share the contents of your /etc/rc.conf and /etc/resolv.conf files with us.


----------



## worldi (Feb 9, 2014)

I've had some trouble with this NIC on a NetGear switch. Sometimes link detection failed (no lights), other times they negotiated 100Mbit instead of 1Gbit (and the link would just die later on). The trick was to beat the chip into Gbit mode:


```
ifconfig_re0="... media 1000baseT mediaopt full-duplex ..."
```


----------



## rrichard (Feb 9, 2014)

Thanks for your suggestion @worldi, it sounded promising but unfortunately it hasn't fixed my issue.  Since my switch supports 100Mbit I set the media to 100Mbit instead of 1000Mbit.
It still seems that I have to take the interface down and bring it back up before it will work as I'd expect. Could it be that the interface is not actually ready to be configured at that stage in the boot process?  

@trh411: Actually networking was set-up during install and I chose to use DHCP. It's just that it never obtained an IP address etc in the process. Then on the next screen where you would normally see the IP addresses for the nameservers I had two empty fields. In my rc.conf I have ifconfig_re0="DHCP" and I've also tried giving it a static IP.


----------



## trh411 (Feb 9, 2014)

rrichard said:
			
		

> trh411: Actually networking was set-up during install and I chose to use DHCP it's just that it never obtained an IP address etc in the process. Then on the next screen where you would normally see the IP addresses for the nameservers I had two empty fields. In my rc.conf I have ifconfig_re0="DHCP" and I've also tried giving it a static IP.


Do you have any nameserver entries in your /etc/resolv.conf file?


----------



## rrichard (Feb 9, 2014)

What difference would that make?  My issue is not with resolving domain names.
In any case yes I have nameserver entries in resolv.conf.


----------



## rrichard (Feb 10, 2014)

In an earlier thread regarding a different issue with this NIC another member has described the same problem as the one I am having with it.
Following conversation in that thread the member @marcinkk has filed a bug report which can be found at http://www.freebsd.org/cgi/query-pr.cgi?pr=186401
The other thread mentioned is at https://forums.freebsd.org/viewtopic.php?f=32&t=22664&p=250135#p127843


----------



## rrichard (Feb 11, 2014)

After reading the bug report I've recompiled my kernel with the newer re driver from HEAD and also applied the patch mentioned however the problem persists.
I'm not sure if my problem relates to any bug in the driver at all or if is just because I have not configured something properly. Setup was done by the installer.
To take DHCP out of the equation I have set a static IP for the interface.

in my rc.conf I have:

```
ifconfig_re0="inet 192.168.0.10 netmask 255.255.255.0"
defaultrouter="192.168.0.1"
```
in my resolv.conf I have:

```
nameserver 194.168.4.100
nameserver 194.168.8.100
```

After login I do `ifconfig re0` and see the expected output then run `ping 192.168.0.1` to test and get nothing. So I run `sudo ifconfig re0 down` followed by `sudo ifconfig re0 up` and then run `ping 192.168.0.1` and the ping is now successful.


----------



## syriangasol (Aug 13, 2014)

I have this same exact NIC. I'm looking to switch from Debian to FreeBSD, however wanted to make sure that it works perfectly with FreeBSD? rrichard, can you confirm?


----------



## gkbsd (Aug 14, 2014)

I have a Shuttle with a RTL8111G NIC and it is not working on FreeBSD 10-RELEASE (same symptoms as you). I had to install FreeBSD 10-STABLE, and it is working perfectly since. Same with OpenBSD, I had to install the CURRENT branch to get the NIC working. I guess it will be natively supported in FreeBSD 10.1-RELEASE this November?

Guillaume.


----------



## rrichard (Sep 6, 2014)

As a workaround for the problem I have with my NIC I just added the below to /etc/rc.local


```
/sbin/ifconfig re0 down
/sbin/ifconfig re0 up
```

NIC works fine after doing that.


----------

