我在家里使用笔记本电脑,似乎存在无法使用有线连接的问题。我最近升级到了 Ubuntu 18.04 LTS(内核版本 5.3.0-40-generic)。
我妻子的电脑上也有 Ubuntu 18.04,并且运行良好:她也是通过电线连接的。
我的网络适配器没有获取 IP 地址:
enp0s31f6: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether 50:7b:9d:f9:b2:e8 txqueuelen 1000 (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
device interrupt 16 memory 0xf1400000-f1420000
我已经运行了命令
sudo dhclient -v enp0s31f6
Listening on LPF/enp0s31f6/50:7b:9d:f9:b2:e8
Sending on LPF/enp0s31f6/50:7b:9d:f9:b2:e8
Sending on Socket/fallback
DHCPDISCOVER on enp0s31f6 to 255.255.255.255 port 67 interval 3 (xid=0x4007ea6f)
卡住了!DHCP 发现!看来我的有线网络适配器出现故障。我认为这是驱动程序的问题。我已检查:
sudo lshw -C network
输出为(虚拟网络设备已被过滤):
*-network
description: Wireless interface
product: QCA6174 802.11ac Wireless Network Adapter
vendor: Qualcomm Atheros
physical id: 0
bus info: pci@0000:01:00.0
logical name: wlp1s0
version: 20
serial: c8:ff:28:6a:4e:61
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless
configuration: broadcast=yes driver=ath10k_pci driverversion=5.3.0-40-generic firmware=SW_RM.1.1.1-00157-QCARMSWPZ-1 ip=192.168.1.4 latency=0 link=yes multicast=yes wireless=IEEE 802.11
resources: irq:131 memory:f1000000-f11fffff
*-network
description: Ethernet interface
product: Ethernet Connection I219-V
vendor: Intel Corporation
physical id: 1f.6
bus info: pci@0000:00:1f.6
logical name: enp0s31f6
version: 21
serial: 50:7b:9d:f9:b2:e8
capacity: 1Gbit/s
width: 32 bits
clock: 33MHz
capabilities: pm msi bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
configuration: autonegotiation=on broadcast=yes driver=e1000e driverversion=3.2.6-k firmware=0.13-4 latency=0 link=no multicast=yes port=twisted pair
resources: irq:128 memory:f1400000-f141ffff
命令的输出:
sudo journalctl -b 0 /usr/sbin/NetworkManager
Mar 06 08:58:06 speedtLaptop NetworkManager[629]: <info> [1583477886.0632] init!
Mar 06 08:58:06 speedtLaptop NetworkManager[629]: <info> [1583477886.0817] interface-parser: parsing file /etc/network/interfaces
Mar 06 08:58:06 speedtLaptop NetworkManager[629]: <info> [1583477886.0818] interface-parser: finished parsing file /etc/network/interfaces
Mar 06 08:58:06 speedtLaptop NetworkManager[629]: <info> [1583477886.0818] management mode: unmanaged
Mar 06 08:58:06 speedtLaptop NetworkManager[629]: <info> [1583477886.0823] devices added (path: /sys/devices/pci0000:00/0000:00:1f.6/net/enp0s31f6, iface: enp0s31f6)
Mar 06 08:58:06 speedtLaptop NetworkManager[629]: <info> [1583477886.0823] device added (path: /sys/devices/pci0000:00/0000:00:1f.6/net/enp0s31f6, iface: enp0s31f6): no ifupdown configuration found.
Mar 06 08:58:06 speedtLaptop NetworkManager[629]: <info> [1583477886.0823] devices added (path: /sys/devices/virtual/net/lo, iface: lo)
Mar 06 08:58:06 speedtLaptop NetworkManager[629]: <info> [1583477886.0823] device added (path: /sys/devices/virtual/net/lo, iface: lo): no ifupdown configuration found.
Mar 06 08:58:06 speedtLaptop NetworkManager[629]: <info> [1583477886.0823] end _init.
由于文件:/etc/network/interfaces
内容是仅有的:
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
我添加了两行:
auto enp0s31f6
iface enp0s31f6 inet dhcp
但当我输入命令时似乎:
sudo ifup enp0s31f6
它似乎永远停留在 DHCPDISCOVER 上。
我运行命令时出现同样的问题:
sudo dhclient -v enp0s31f6
怎么了?为什么有线连接时我无法从家用路由器接收 IP?
也许有人有什么建议吗?
答案1
我会删除你添加到的位/etc/network/interfaces
:Ubuntu 18.04 使用网络计划而不是ifupdown
,无论如何,您都应该让 NetworkManager 处理您的有线和无线连接。您无需通过 中的配置文件手动输入内容/etc/
。
您是否尝试使用nmtui
(NetworkManager 用户界面)来确保接口已打开并配置为使用 DHCP?
此外,添加 的输出也不会有什么坏处ip addr
。