我正在尝试通过以太网接收互联网连接。我的桌面运行的是 Ubuntu 16.04。
网络管理器小程序报告已连接到enp0s31f6
,但我的计算机尚未收到 DHCP 地址。
dhclient
输出似乎表明没有DHCPOFFER
从服务器接收到任何请求(DHCPDISCOVER
发送了更多请求但输出没有变化):
~$ sudo dhclient -v enp0s31f6
Internet Systems Consortium DHCP Client 4.3.3
Copyright 2004-2015 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Listening on LPF/enp0s31f6/0c:9d:92:bd:9b:57
Sending on LPF/enp0s31f6/0c:9d:92:bd:9b:57
Sending on Socket/fallback
DHCPDISCOVER on enp0s31f6 to 255.255.255.255 port 67 interval 3 (xid=0xfff5a066)
DHCPDISCOVER on enp0s31f6 to 255.255.255.255 port 67 interval 8 (xid=0xfff5a066)
DHCPDISCOVER on enp0s31f6 to 255.255.255.255 port 67 interval 13 (xid=0xfff5a066)
DHCPDISCOVER on enp0s31f6 to 255.255.255.255 port 67 interval 13 (xid=0xfff5a066)
ethtool
报告以下信息。和Unknown!
属性的值似乎可疑。当这些值未知时,我是否能够连接?如果不能,我该如何解决这个未知值问题?Speed
Duplex
~$ sudo ethtool enp0s31f6
Settings for enp0s31f6:
Supported ports: [ TP ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Supported pause frame use: No
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Advertised pause frame use: No
Advertised auto-negotiation: Yes
Speed: Unknown!
Duplex: Unknown! (255)
Port: Twisted Pair
PHYAD: 2
Transceiver: internal
Auto-negotiation: on
MDI-X: Unknown (auto)
Supports Wake-on: pumbg
Wake-on: g
Current message level: 0x00000007 (7)
drv probe link
Link detected: no
我尝试手动设置它们的值,但无济于事:
~$ sudo ethtool -s enp0s31f6 speed 1000 duplex full
~$ sudo ethtool enp0s31f6
Settings for enp0s31f6:
Supported ports: [ TP ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Supported pause frame use: No
Supports auto-negotiation: Yes
Advertised link modes: 1000baseT/Full
Advertised pause frame use: No
Advertised auto-negotiation: Yes
Speed: Unknown!
Duplex: Unknown! (255)
Port: Twisted Pair
PHYAD: 2
Transceiver: internal
Auto-negotiation: on
MDI-X: Unknown (auto)
Supports Wake-on: pumbg
Wake-on: g
Current message level: 0x00000007 (7)
drv probe link
Link detected: no
以下是从中过滤的一些片段dmesg
,如果它们相关的话:
~$ dmesg | grep enp
[ 1.719930] e1000e 0000:00:1f.6 enp0s31f6: renamed from eth0
[ 7.980215] IPv6: ADDRCONF(NETDEV_UP): enp0s31f6: link is not ready
[ 8.221865] IPv6: ADDRCONF(NETDEV_UP): enp0s31f6: link is not ready
[ 314.654059] IPv6: ADDRCONF(NETDEV_UP): enp0s31f6: link is not ready
~$ dmesg | grep e1000e
[ 1.339047] e1000e: Intel(R) PRO/1000 Network Driver - 3.2.6-k
[ 1.339047] e1000e: Copyright(c) 1999 - 2015 Intel Corporation.
[ 1.406037] e1000e 0000:00:1f.6: Interrupt Throttling Rate (ints/sec) set to dynamic conservative mode
[ 1.651130] e1000e 0000:00:1f.6 0000:00:1f.6 (uninitialized): registered PHC clock
[ 1.719235] e1000e 0000:00:1f.6 eth0: (PCI Express:2.5GT/s:Width x1) 0c:9d:92:bd:9b:57
[ 1.719236] e1000e 0000:00:1f.6 eth0: Intel(R) PRO/1000 Network Connection
[ 1.719304] e1000e 0000:00:1f.6 eth0: MAC: 12, PHY: 12, PBA No: FFFFFF-0FF
[ 1.719930] e1000e 0000:00:1f.6 enp0s31f6: renamed from eth0
Ubuntu 网络管理器 GUI 报告“有线”连接已“连接”,但没有分配地址。
到目前为止,我在调试过程中已多次重新启动机器,但问题仍未得到解决。
附加信息:
~$ ip link 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: enp0s31f6: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 1000
link/ether 0c:9d:92:bd:9b:57 brd ff:ff:ff:ff:ff:ff
3: wlxe091f519b0f3: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN mode DORMANT group default qlen 1000
link/ether e0:91:f5:19:b0:f3 brd ff:ff:ff:ff:ff:ff
~$ ip route
default via ABC.DEF.176.1 dev wlxe091f519b0f3 proto static metric 600
default dev enp0s31f6 scope link metric 1002 linkdown
ABC.DEF.176.0/20 dev wlxe091f519b0f3 proto kernel scope link src ABC.DEF.188.112 metric 600
HIJ.KLM.0.0/16 dev enp0s31f6 proto kernel scope link src HIJ.KLM.9.24 linkdown
[上面有些 IP 号码被字母掩盖]
一个可能有趣的信息来自:
journalctl /usr/sbin/NetworkManager
:
<info> [1564430899.7494] device (enp0s31f6): state change: unmanaged -> unavailable (reason 'managed') [10 20 2]
Jul 29 16:08:19 computer NetworkManager[947]: nm_device_get_device_type: assertion 'NM_IS_DEVICE (self)' failed
答案1
输出结果ip link show
如下:
enp0s31f6: <NO-CARRIER
和dmesg
表演
enp0s31f6: link is not ready
都表明物理连接存在问题。
一些可能的原因:
- 插头没有正确卡入到位
- 电缆有缺陷
- 交换机端口已停用或有缺陷
答案2
即使电缆插入正确(用另一台设备检查)并获取信息,我也无法连接到互联网。原因是速度和双面打印没有设置,我需要使用ethtool将速度设置为 100 Mb/s 并将双工设置为全双工:
sudo ethtool -s <adapter_name> speed 100 duplex full
<adapter_name>
使用命令时显示的适配器名称在哪里ip a
。
同样的问题也出现在另一个操作系统(Windows 11)上,原因也是相同的——我需要在网络设置中设置速度和双工。