Ubuntu 20.04 以太网 R8168

Ubuntu 20.04 以太网 R8168

在此处输入图片描述

在此处输入图片描述 这是我的硬件的信息:

lshw

ubuntu@ubuntu:~$ sudo 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: 09
       serial: 04:d9:f5:31:bf:d6
       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-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=5.8.0-43-generic firmware=rtl8168f-1_0.0.5 06/18/12 latency=0 link=no multicast=yes port=MII
       resources: irq:17 ioport:e000(size=256) memory:f0004000-f0004fff memory:f0000000-f0003fff
  *-network
       description: Ethernet interface
       physical id: 2
       bus info: usb@2:1.6
       logical name: usb0
       serial: 4a:95:ce:43:80:51
       capabilities: ethernet physical
       configuration: broadcast=yes driver=rndis_host driverversion=22-Aug-2005 firmware=RNDIS device ip=192.168.42.193 link=yes multicast=yes

问题出现RTL8111/8167/8411在我的系统上

nmcli

ubuntu@ubuntu:~$ sudo nmcli
usb0: connected to Wired connection 2
        "Qualcomm SDM636-QRD SN:3166A9F8"
        ethernet (rndis_host), 4A:95:CE:43:80:51, hw, mtu 1500
        ip4 default
        inet4 192.168.42.193/24
        route4 0.0.0.0/0
        route4 192.168.42.0/24
        route4 169.254.0.0/16
        inet6 fe80::a150:e699:1a23:b83f/64
        route6 fe80::/64
        route6 ff00::/8

enp3s0: unavailable
        "Realtek RTL8111/8168/8411"
        ethernet (r8169), 04:D9:F5:31:BF:D6, hw, mtu 1500

lo: unmanaged
        "lo"
        loopback (unknown), 00:00:00:00:00:00, sw, mtu 65536

DNS configuration:
        servers: 192.168.42.129
        interface: usb0

Use "nmcli device show" to get complete information about known devices and
"nmcli connection show" to get an overview on active connection profiles.

Consult nmcli(1) and nmcli-examples(7) manual pages for complete usage details.

- - - 更新 - - - -

route -n

ubuntu@Linux:~$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.42.129  0.0.0.0         UG    20100  0        0 usb0
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 usb0
192.168.42.0    0.0.0.0         255.255.255.0   U     100    0        0 usb0

ip a

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp3s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000
    link/ether 04:d9:f5:31:bf:d6 brd ff:ff:ff:ff:ff:ff
4: usb0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UNKNOWN group default qlen 1000
    link/ether e6:4a:fc:3a:7c:8b brd ff:ff:ff:ff:ff:ff
    inet 192.168.42.109/24 brd 192.168.42.255 scope global dynamic noprefixroute usb0
       valid_lft 3104sec preferred_lft 3104sec
    inet6 fe80::6e7f:9504:2062:a207/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever

lsusb

Bus 002 Device 003: ID 046d:c534 Logitech, Inc. Unifying Receiver
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

寻找/etc/network/interfaces但得到这个结果:

ubuntu@Linux:/etc/network$ ls -la
total 32
drwxr-xr-x   6 root root  4096 Feb 10 01:50 .
drwxr-xr-x 134 root root 12288 Mar 29 00:19 ..
drwxr-xr-x   2 root root  4096 Mar 28 22:24 if-down.d
drwxr-xr-x   2 root root  4096 Mar 28 22:24 if-post-down.d
drwxr-xr-x   2 root root  4096 Mar 28 22:36 if-pre-up.d
drwxr-xr-x   2 root root  4096 Mar 28 22:36 if-up.d

/etc/netplan/01-network-manager-all.yaml

# Let NetworkManager manage all devices on this system
network:
  version: 2
  renderer: NetworkManager

答案1

这可能是驱动程序问题。您是否安装了r8168 RealTek 驱动程序?

sudo apt-get update

sudo apt-get install r8168-dkms

** 编辑 **

请注意,此驱动程序仅应用于内核驱动程序 r8169 尚不支持的设备。安装 r8168-dkms 软件包将禁用内核 r8169 模块。要重新启用 r8169,必须清除 r8168-dkms 软件包。

阅读此帖子也可能会有帮助

答案2

感谢所有回答我的问题的人,我用这个方法解决了我的问题:

如果安装了 r8168-dkms,请先删除:

user@linux:~$ sudo apt purge r8168-dkms

确保安装build-essential

user@linux:~$ sudo apt-get install build-essential linux-headers-$(uname -r)

将 r8169 驱动程序列入黑名单:

user@linux:~$ sudo sh -c 'echo blacklist r8169 >> /etc/modprobe.d/blacklist.conf'

我用GBE 以太网 LINUX 驱动程序 r8168 适用于内核 5.6 及以上版本 (Unix(Linux))对于驱动程序,下载驱动程序后打开终端并找到文件:

user@linux:~$ cd /path/to/file
user@linux:~$ tar xfvj r8168-8.048.03.tar.bz2
user@linux:~$ cd r8168-8.048.03

最后一步:

user@linux:~$ sudo ./autorun.sh

lsmod | grep r8使用或检查驱动程序是否正常工作ethtool

user@linux:~$ cd ethtool -i <your_logical_name>

为我:

user@linux:~$ cd ethtool -i enp3s0

输出:

driver: r8168
version: 8.048.03-NAPI
firmware-version: 
expansion-rom-version: 
bus-info: 0000:03:00.0
supports-statistics: yes
supports-test: no
supports-eeprom-access: no
supports-register-dump: yes
supports-priv-flags: no

然后重新启动。

相关内容