在我的 Ubuntu 17.04 Dell Latitude 笔记本电脑上,我使用扩展坞。该扩展坞具有专用连接。
- 当我将笔记本电脑接入工作站时,它无限期地显示“正在连接”状态图标。就像它尝试连接,然后重置,然后再次尝试连接。
- 当我拔下电缆,等待一会儿并再次连接时,连接立即建立。
从睡眠中恢复时这种情况可能更频繁地发生。但尝试更改 BIOS 电源选项无济于事。
它在 Ubuntu 16.10 上运行良好,但我不确定 17.04 之后是否出现问题,因为其他因素也发生了变化。
笔记本电脑和路由器之间的 10/100Mbit 交换机比较旧,连接协商可能耗时太长?但网络打印机连接没有问题。
更新:
尝试重新加载以太网驱动程序modprobe -r -v tg3
,modprobe -v rg3
并重新启动网络服务。
运行dmesg
显示很多链接启动/链接关闭消息:
[92580.119745] tg3 0000:09:00.0 eth0: Link is up at 100 Mbps, full duplex
[92580.119768] tg3 0000:09:00.0 eth0: Flow control is on for TX and on for RX
[92580.774047] tg3 0000:09:00.0 eth0: Link is down
[92582.426348] tg3 0000:09:00.0 eth0: Link is up at 100 Mbps, full duplex
[92582.426351] tg3 0000:09:00.0 eth0: Flow control is on for TX and on for RX
[92583.368441] tg3 0000:09:00.0 eth0: Link is down
[92585.047635] tg3 0000:09:00.0 eth0: Link is up at 100 Mbps, full duplex
[92585.047662] tg3 0000:09:00.0 eth0: Flow control is on for TX and on for RX
[92585.562763] tg3 0000:09:00.0 eth0: Link is down
[92587.207396] tg3 0000:09:00.0 eth0: Link is up at 100 Mbps, full duplex
[92587.207418] tg3 0000:09:00.0 eth0: Flow control is on for TX and on for RX
[92588.085716] tg3 0000:09:00.0 eth0: Link is down
[92589.744788] tg3 0000:09:00.0 eth0: Link is up at 100 Mbps, full duplex
[92589.744816] tg3 0000:09:00.0 eth0: Flow control is on for TX and on for RX
[92590.706366] tg3 0000:09:00.0 eth0: Link is down
[92592.296863] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[92592.365857] tg3 0000:09:00.0 eth0: Link is up at 100 Mbps, full duplex
[92592.365860] tg3 0000:09:00.0 eth0: Flow control is on for TX and on for RX
[92592.365876] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[92593.326975] tg3 0000:09:00.0 eth0: Link is down
[92594.987186] tg3 0000:09:00.0 eth0: Link is up at 100 Mbps, full duplex
[92594.987212] tg3 0000:09:00.0 eth0: Flow control is on for TX and on for RX
[92595.947772] tg3 0000:09:00.0 eth0: Link is down
[92597.608392] tg3 0000:09:00.0 eth0: Link is up at 100 Mbps, full duplex
[92597.608416] tg3 0000:09:00.0 eth0: Flow control is on for TX and on for RX
[92598.568514] tg3 0000:09:00.0 eth0: Link is down
[92600.229535] tg3 0000:09:00.0 eth0: Link is up at 100 Mbps, full duplex
[92600.229548] tg3 0000:09:00.0 eth0: Flow control is on for TX and on for RX
当连接停止时,Wireshark 会记录日志:
No. Time Source Destination Protocol Length Info
7 2.660584149 0.0.0.0 255.255.255.255 DHCP 342 DHCP Request - Transaction ID 0xde0c185d
Frame 7: 342 bytes on wire (2736 bits), 342 bytes captured (2736 bits) on interface 0
Ethernet II, Src: Dell_39:4b:6e (d0:67:e5:39:4b:6e), Dst: Broadcast (ff:ff:ff:ff:ff:ff)
Internet Protocol Version 4, Src: 0.0.0.0, Dst: 255.255.255.255
User Datagram Protocol, Src Port: 68, Dst Port: 67
Bootstrap Protocol (Request)
No. Time Source Destination Protocol Length Info
12 5.401359750 0.0.0.0 255.255.255.255 DHCP 342 DHCP Request - Transaction ID 0xde0c185d
Frame 12: 342 bytes on wire (2736 bits), 342 bytes captured (2736 bits) on interface 0
Ethernet II, Src: Dell_39:4b:6e (d0:67:e5:39:4b:6e), Dst: Broadcast (ff:ff:ff:ff:ff:ff)
Internet Protocol Version 4, Src: 0.0.0.0, Dst: 255.255.255.255
User Datagram Protocol, Src Port: 68, Dst Port: 67
Bootstrap Protocol (Request)
No. Time Source Destination Protocol Length Info
35 13.832656290 0.0.0.0 255.255.255.255 DHCP 342 DHCP Discover - Transaction ID 0xb9200f10
Frame 35: 342 bytes on wire (2736 bits), 342 bytes captured (2736 bits) on interface 0
Ethernet II, Src: Dell_39:4b:6e (d0:67:e5:39:4b:6e), Dst: Broadcast (ff:ff:ff:ff:ff:ff)
Internet Protocol Version 4, Src: 0.0.0.0, Dst: 255.255.255.255
User Datagram Protocol, Src Port: 68, Dst Port: 67
Bootstrap Protocol (Discover)
重新连接电缆后,Wireshark 立即记录:
No. Time Source Destination Protocol Length Info
13 12.440180322 0.0.0.0 255.255.255.255 DHCP 342 DHCP Request - Transaction ID 0xc06e5459
Frame 13: 342 bytes on wire (2736 bits), 342 bytes captured (2736 bits) on interface 0
Ethernet II, Src: Dell_39:4b:6e (d0:67:e5:39:4b:6e), Dst: Broadcast (ff:ff:ff:ff:ff:ff)
Internet Protocol Version 4, Src: 0.0.0.0, Dst: 255.255.255.255
User Datagram Protocol, Src Port: 68, Dst Port: 67
Bootstrap Protocol (Request)
No. Time Source Destination Protocol Length Info
14 12.444870618 192.168.1.254 192.168.1.5 DHCP 358 DHCP ACK - Transaction ID 0xc06e5459
Frame 14: 358 bytes on wire (2864 bits), 358 bytes captured (2864 bits) on interface 0
Ethernet II, Src: VtechTel_55:61:31 (00:12:2a:55:61:31), Dst: Dell_39:4b:6e (d0:67:e5:39:4b:6e)
Internet Protocol Version 4, Src: 192.168.1.254, Dst: 192.168.1.5
User Datagram Protocol, Src Port: 67, Dst Port: 68
Bootstrap Protocol (ACK)
No. Time Source Destination Protocol Length Info
15 12.463981621 192.168.1.5 224.0.0.22 IGMPv3 62 Membership Report / Join group 224.0.0.252 for any sources / Join group 224.0.0.251 for any sources
Frame 15: 62 bytes on wire (496 bits), 62 bytes captured (496 bits) on interface 0
Ethernet II, Src: Dell_39:4b:6e (d0:67:e5:39:4b:6e), Dst: IPv4mcast_16 (01:00:5e:00:00:16)
Internet Protocol Version 4, Src: 192.168.1.5, Dst: 224.0.0.22
Internet Group Management Protocol
答案1
几个月前,我的以太网暂停/恢复功能运行正常,但自动更新却让它无法工作了,之前它已经运行了大约 6 个月。大约在同一时间,这里的其他几个用户也遇到了同样的情况。
对我来说,解决方案是创建一个在从暂停状态恢复时执行的脚本:
#!/bin/bash
# NAME: r8169-reset
# PATH: /lib/systemd/system-sleep
# DESC: Reset Ethernet card after suspend, not working automatically
# DATE: Feb ?? 2017. Modified: Apr 30, 2017.
MYNAME=$0
restart_ethernet() {
/usr/bin/logger $MYNAME 'restart_ethernet(r8169) BEGIN'
/sbin/modprobe -v -r r8169
# /sbin/modprobe -v -r mii
/sbin/modprobe -v r8169
/usr/bin/logger 'systemctl restart NetworkManager.service (SUPPRESED)'
/usr/bin/logger $MYNAME 'restart_ethernet(r8169) END'
}
/usr/bin/logger $MYNAME 'case=[' ${1}' ]'
case "${1}/${2}" in
hibernate|suspend|pre*)
;;
resume|thaw|post*)
restart_ethernet;;
esac
将脚本保存到/lib/systemd/system-sleep/r8169-reset
。当然,将此脚本名称更改为您的实际驱动程序名称。还要更改脚本中的驱动程序内核模块名称。
请注意以下这一行:
/usr/bin/logger 'systemctl restart NetworkManager.service (SUPPRESED)'
有时只需重新启动网络管理器就足够了,您也可以尝试一下。
您需要 sudo 权限才能保存文件。为了保险起见,我始终将这些脚本标记为executable
使用:
sudo chmod a+x /lib/systemd/system-sleep/r8169-reset
您可以检查/var/log/syslog
脚本的输出。
希望这对你有用。