[Switch] Ubuntu 16.04 RTL8111/8168/8411 can't access the Internet and often disconnects the network solution

System environment:
OS: Ubuntu 16.04 LTS 64-bit

  I have also encountered such a problem before. When using the wired network to access the Internet, sometimes the network will be disconnected, but generally it can be used after re-enabling the network. But after the disconnection this time, there is no way to connect to the Internet. Later, after searching the Internet for a long time, I finally found the reason, which is caused by the driver problem of the network card.

Find the problem

First, check the system log:
# cat / var / log / syslog | grep enp
NetworkManager[1002]: <info>  [1494831368.7343] device (enp3s0): state change: disconnected -> unmanaged (reason 'sleeping') [30 10 37]
NetworkManager[1002]: <info>  [1494831368.7589] device (enp3s0): link disconnected
NetworkManager[1002]: <info>  [1494831376.6517] device (enp3s0): state change: unmanaged -> unavailable (reason 'managed') [10 20 2]
kernel: [  602.158370] IPv6: ADDRCONF(NETDEV_UP): enp3s0: link is not ready
kernel: [  602.286519] r8169 0000:03:00.0 enp3s0: link down

Then execute the following command to check the system kernel version:
# uname -a
Linux ubuntupc 4.4.0-77-generic #98-Ubuntu SMP Wed Apr 26 08:34:02 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

Then check the network card and the driver information used:
# lspci -knn
......
......
03:00.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller [10ec:8168] (rev 06)
	Subsystem: Dell RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller [1028:0585]
	Kernel driver in use: r8169
	Kernel modules: r8169

Note : The above information shows that the network card is Dell RTL8111/8168/8411, but the driver used is "r8169", so this is the problem.

Tips:
You can also execute the following commands to view the network card and version information:
# lshw -C network
  *-network               
       description: Ethernet interface
       product: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
       vendor: Realtek Semiconductor Co., Ltd.
       physical id: 0
       bus info: pci@0000:03:00.0
       logical name: enp3s0
       version: 06
       serial: xx:bb:cc:yy:dd:zz
       size: 100Mbit/s
       capacity: 1Gbit/s
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress msix vpd bus_master cap_list ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt 1000bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=2.3LK-NAPI duplex=full firmware=rtl8168e-3_0.0.4 03/27/12 ip=192.168.21.189 latency=0 link=yes multicast=yes port=MII speed=100Mbit/s
       resources: irq:26 ioport:d000(size=256) memory:f2104000-f2104fff memory:f2100000-f2103fff
......
......

The driver=r8169 driverversion=2.3LK-NAPI is the driver version of the network card.

After the driver is downloaded

, download the driver corresponding to the kernel version on the official website:
http://www.realtek.com.tw/downloads/downloadsView.aspx?Langid=1&PNid=13&PFid=5&Level=5&Conn=4&DownTypeID=3&GetDown=false#2Download
Unix (Linux) LINUX driver for kernel up to 4.7 driver file.

Driver Installation

# tar xjvf 0009-r8168-8.044.02.tar.bz2
# cd r8168-8.044.02/
# ./autorun.sh

Check old driver and unload it.
rmmod r8169
Build the module and install
At main.c:222:
- SSL error:02001002:system library:fopen:No such file or directory: bss_file.c:175
- SSL error:2006D080:BIO routines:BIO_new_file:no such file: bss_file.c:182
sign-file: certs/signing_key.pem: No such file or directory
Backup r8169.ko
rename r8169.ko to r8169.bak
DEPMOD 4.4.0-77-generic
load module r8168
Updating initramfs. Please wait.
update-initramfs: Generating /boot/initrd.img-4.4.0-77-generic
Completed.

Then restart the computer (preferably re-enable the network connection again).

references:

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326232074&siteId=291194637