我全新安装了 Ubuntu 22.10。第一次重启后,无法通过以太网上网(我用旧的 wifi 棒上网)。以下是我发现的情况:
1.
~$ lspci -nnk | grep -iA2 net
0f:00.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL8125 2.5GbE Controller [10ec:8125] (rev 05)
Subsystem: ASRock Incorporation RTL8125 2.5GbE Controller [1849:8125]
Kernel driver in use: r8169
~$ ip l show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp15s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
link/ether a8:a1:59:ec:ba:7d brd ff:ff:ff:ff:ff:ff
9: wlxaca2137f9bfa: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DORMANT group default qlen 1000
link/ether ac:a2:13:7f:9b:fa brd ff:ff:ff:ff:ff:ff
~$ ifconfig
enp15s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet6 2a02:810d:12c0:2758:aaa1:59ff:feec:ba7d prefixlen 64 scopeid 0x0<global>
inet6 fe80::aaa1:59ff:feec:ba7d prefixlen 64 scopeid 0x20<link>
ether a8:a1:59:ec:ba:7d txqueuelen 1000 (Ethernet)
RX packets 46579 bytes 40502901 (40.5 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 22370 bytes 4855246 (4.8 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 26380 bytes 2292970 (2.2 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 26380 bytes 2292970 (2.2 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlxaca2137f9bfa: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.0.106 netmask 255.255.255.0 broadcast 192.168.0.255
inet6 2a02:810d:12c0:2758:aa8c:be9f:e0ff:b362 prefixlen 64 scopeid 0x0<global>
inet6 2a02:810d:12c0:2758:e4a7:abbe:7116:ac05 prefixlen 64 scopeid 0x0<global>
inet6 2a02:810d:12c0:2758:21ee:a417:25a7:28e5 prefixlen 128 scopeid 0x0<global>
inet6 fe80::51dd:9aeb:5494:b7ef prefixlen 64 scopeid 0x20<link>
ether ac:a2:13:7f:9b:fa txqueuelen 1000 (Ethernet)
RX packets 79599 bytes 97671453 (97.6 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 48421 bytes 6691084 (6.6 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
它在我的 WiFi 路由器上显示如下:
Name: a8:a1:59:ec:ba:7d
IPv4: 192.168.0.80
IPv6: 2a02:810d:12c0:2758:5884:f3e5:1af4:20ca
MAC: a8:a1:59:ec:ba:7d
Geschwindigkeit: 1 Gbps
Bemerkungen:
所以在我看来它获得了一个 ipv6 地址,但没有 ipv4 地址。这就是为什么我尝试使用以下命令关闭 ipv6:
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1
sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=1
这没有帮助。 ifconfig 会导致
~$ ifconfig
enp15s0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether a8:a1:59:ec:ba:7d txqueuelen 1000 (Ethernet)
RX packets 47466 bytes 40630730 (40.6 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 22423 bytes 4864695 (4.8 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
下列的这建议我将驱动模块 r8169 列入黑名单,因为它可能被错误使用。
echo "blacklist r8169" | sudo tee /etc/modprobe.d/blacklist_r8169.conf
这导致网卡根本不显示:
~$ ifconfig
docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 172.17.0.1 netmask 255.255.0.0 broadcast 172.17.255.255
ether 02:42:64:99:78:2d txqueuelen 0 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 322 bytes 26855 (26.8 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 322 bytes 26855 (26.8 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
是否使用了错误的内核模块?
~$ modprobe -c | grep 8125 | grep 10EC
别名 pci:v000010ECd00008125sv标准差公元前陣容我* r8169
按照 dummyuser 的建议使用后dhclient -4 enp15s0
,互联网可以正常工作,并且 ifconfig 显示
enp15s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.0.80 netmask 255.255.255.0 broadcast 192.168.0.255
inet6 2a02:810d:12c0:2758:aaa1:59ff:feec:ba7d prefixlen 64 scopeid 0x0<global>
inet6 fe80::aaa1:59ff:feec:ba7d prefixlen 64 scopeid 0x20<link>
ether a8:a1:59:ec:ba:7d txqueuelen 1000 (Ethernet)
RX packets 18089 bytes 11957535 (11.9 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 7174 bytes 755765 (755.7 KB)
TX errors 8 dropped 0 overruns 0 carrier 0 collisions 0
tail -200 /var/log/syslog | grep dhclient
结果是
Dec 30 15:00:39 gandalf-the-white dhclient[42914]: xid: warning: no netdev with useable HWADDR found for seed's uniqueness enforcement
Dec 30 15:00:39 gandalf-the-white dhclient[42914]: xid: rand init seed (0x63d1fc16) built using gethostid
Dec 30 15:00:39 gandalf-the-white dhclient[42914]: DHCPDISCOVER on enp15s0 to 255.255.255.255 port 67 interval 3 (xid=0xc0ef4636)
Dec 30 15:00:39 gandalf-the-white dhclient[42914]: DHCPOFFER of 192.168.0.80 from 192.168.0.1
Dec 30 15:00:39 gandalf-the-white dhclient[42914]: DHCPREQUEST for 192.168.0.80 on enp15s0 to 255.255.255.255 port 67 (xid=0x3646efc0)
Dec 30 15:00:39 gandalf-the-white dhclient[42914]: DHCPACK of 192.168.0.80 from 192.168.0.1 (xid=0xc0ef4636)
Dec 30 15:00:39 gandalf-the-white dhclient[42914]: bound to 192.168.0.80 -- renewal in 286134 seconds.