我是 Ubuntu 新手,最近丢失了互联网连接 - 无法连接到 8.8.8.8 或 google.com。我打开网络管理器,它显示我已连接到正确的硬件地址和 IP 地址 fe80::1037:4526:e2b:d5c3 。但是,这不是我的以太网路由器的 IP 地址。我能够通过同一台计算机上的 Windows 分区连接到此以太网端口。IPv4 设置为自动(DHCP),IPv6 设置为自动。以下是一些相关命令的输出:
$ ip addr
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: enp0s25: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 98:90:96:a5:d7:ae brd ff:ff:ff:ff:ff:ff
inet6 fe80::1037:4526:e2b:d5c3/64 scope link
valid_lft forever preferred_lft forever
$route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
$dmesg |grep eth0
[ 1.603310] e1000e 0000:00:19.0 eth0: (PCI Express:2.5GT/s:Width x1) 98:90:96:a5:d7:ae
[ 1.603311] e1000e 0000:00:19.0 eth0: Intel(R) PRO/1000 Network Connection
[ 1.603348] e1000e 0000:00:19.0 eth0: MAC: 11, PHY: 12, PBA No: FFFFFF-0FF
[ 1.603863] e1000e 0000:00:19.0 enp0s25: renamed from eth0
$sudo lshw -c network
*-network
description: Ethernet interface
product: Ethernet Connection I217-LM
vendor: Intel Corporation
physical id: 19
bus info: pci@0000:00:19.0
logical name: enp0s25
version: 05
serial: 98:90:96:a5:d7:ae
size: 1Gbit/s
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 duplex=full firmware=0.13-4 latency=0 link=yes multicast=yes port=twisted pair speed=1Gbit/s
resources: irq:28 memory:fb100000-fb11ffff memory:fb139000-fb139fff ioport:f020(size=32)
$ ifconfig -a
enp0s25 Link encap:Ethernet HWaddr 98:90:96:a5:d7:ae
inet6 addr: fe80::1037:4526:e2b:d5c3/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:10151 errors:0 dropped:0 overruns:0 frame:0
TX packets:728 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1715192 (1.7 MB) TX bytes:154706 (154.7 KB)
Interrupt:20 Memory:fb100000-fb120000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:23808 errors:0 dropped:0 overruns:0 frame:0
TX packets:23808 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1798264 (1.7 MB) TX bytes:1798264 (1.7 MB)
$ more /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
$ vi etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
$ls -al /etc/resolv.conf
lrwxrwxrwx 1 root root 29 Jan 7 06:46 /etc/resolv.conf -> ../run/resolvconf/resolv.conf
$ dpkg -l *dns*
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==============-============-============-=================================
ii dns-root-data 2018013001~1 all DNS root data including root zone
un dnscache-run <none> <none> (no description available)
un dnsmasq <none> <none> (no description available)
ii dnsmasq-base 2.75-1ubuntu amd64 Small caching DNS proxy and DHCP/
ii dnsutils 1:9.10.3.dfs amd64 Clients provided with BIND
un fpdns <none> <none> (no description available)
un isc-dhcp-clien <none> <none> (no description available)
un isc-dhcp-clien <none> <none> (no description available)
un libapache2-mod <none> <none> (no description available)
ii libdns-export1 1:9.10.3.dfs amd64 Exported DNS Shared Library
ii libdns162:amd6 1:9.10.3.dfs amd64 DNS Shared Library used by BIND
ii libnet-dns-per 0.81-2build1 amd64 Perform DNS queries from a Perl s
un libnet-dns-sec <none> <none> (no description available)
ii libnss-mdns:am 0.10-7 amd64 NSS module for Multicast DNS name
un pdnsd <none> <none> (no description available)
un rdnssd <none> <none> (no description available)
$ dpkg -l *resolv*
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==============-============-============-=================================
ii resolvconf 1.78ubuntu6 all name server information handler
$ ls -al /boot
total 139844
drwxr-xr-x 3 root root 4096 Jan 11 14:24 .
drwxr-xr-x 25 root root 4096 Jan 11 14:21 ..
-rw-r--r-- 1 root root 1537161 Jul 18 2018 abi-4.15.0-29-generic
-rw-r--r-- 1 root root 216815 Jul 18 2018 config-4.15.0-29-generic
-rw-r--r-- 1 root root 217026 Dec 7 11:05 config-4.15.0-43-generic
drwxr-xr-x 5 root root 4096 Jan 11 14:23 grub
-rw-r--r-- 1 root root 54459735 Jan 8 06:48 initrd.img-4.15.0-29-generic
-rw-r--r-- 1 root root 61868943 Jan 11 14:24 initrd.img-4.15.0-43-generic
-rw-r--r-- 1 root root 182704 Jan 28 2016 memtest86+.bin
-rw-r--r-- 1 root root 184380 Jan 28 2016 memtest86+.elf
-rw-r--r-- 1 root root 184840 Jan 28 2016 memtest86+_multiboot.bin
-rw-r--r-- 1 root root 0 Jul 18 2018 retpoline-4.15.0-29-generic
-rw------- 1 root root 4039561 Jul 18 2018 System.map-4.15.0-29-generic
-rw------- 1 root root 4047366 Dec 7 11:05 System.map-4.15.0-43-generic
-rw-r--r-- 1 root root 8101496 Jul 30 2018 vmlinuz-4.15.0-29-generic
-rw------- 1 root root 8119768 Dec 8 04:43 vmlinuz-4.15.0-43-generic
$ cat /etc/NetworkManager/NetworkManager.conf
[main]
plugins=ifupdown,keyfile,ofono
dns=dnsmasq
[ifupdown]
managed=false
$ cat /etc/systemd/resolved.conf
[Resolve]
#DNS=
#FallbackDNS=8.8.8.8 8.8.4.4 2001:4860:4860::8888 2001:4860:4860::8844
#Domains=
#LLMNR=yes
#DNSSEC=no
$ dmesg |grep -i dhcp
[ 12.059135] audit: type=1400 audit(1551975180.569:9): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/lib/NetworkManager/nm-dhcp-client.action" pid=534 comm="apparmor_parser"
[ 12.059137] audit: type=1400 audit(1551975180.569:10): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/lib/NetworkManager/nm-dhcp-helper" pid=534 comm="apparmor_parser"
$ dhclient -v enp0s25
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/enp0s25/98:90:96:a5:d7:ae
Sending on LPF/enp0s25/98:90:96:a5:d7:ae
Sending on Socket/fallback
DHCPDISCOVER on enp0s25 to 255.255.255.255 port 67 interval 3 (xid=0xaa3dfb7d)
DHCPDISCOVER on enp0s25 to 255.255.255.255 port 67 interval 3 (xid=0xaa3dfb7d)
DHCPDISCOVER on enp0s25 to 255.255.255.255 port 67 interval 4 (xid=0xaa3dfb7d)
DHCPDISCOVER on enp0s25 to 255.255.255.255 port 67 interval 8 (xid=0xaa3dfb7d)
DHCPDISCOVER on enp0s25 to 255.255.255.255 port 67 interval 8 (xid=0xaa3dfb7d)
DHCPDISCOVER on enp0s25 to 255.255.255.255 port 67 interval 15 (xid=0xaa3dfb7d)
DHCPDISCOVER on enp0s25 to 255.255.255.255 port 67 interval 15 (xid=0xaa3dfb7d)
DHCPDISCOVER on enp0s25 to 255.255.255.255 port 67 interval 18 (xid=0xaa3dfb7d)
DHCPDISCOVER on enp0s25 to 255.255.255.255 port 67 interval 21 (xid=0xaa3dfb7d)
DHCPDISCOVER on enp0s25 to 255.255.255.255 port 67 interval 14 (xid=0xaa3dfb7d)
DHCPDISCOVER on enp0s25 to 255.255.255.255 port 67 interval 7 (xid=0xaa3dfb7d)
DHCPDISCOVER on enp0s25 to 255.255.255.255 port 67 interval 9 (xid=0xaa3dfb7d)
DHCPDISCOVER on enp0s25 to 255.255.255.255 port 67 interval 11 (xid=0xaa3dfb7d)
DHCPDISCOVER on enp0s25 to 255.255.255.255 port 67 interval 19 (xid=0xaa3dfb7d)
DHCPDISCOVER on enp0s25 to 255.255.255.255 port 67 interval 17 (xid=0xaa3dfb7d)
DHCPDISCOVER on enp0s25 to 255.255.255.255 port 67 interval 13 (xid=0xaa3dfb7d)
DHCPDISCOVER on enp0s25 to 255.255.255.255 port 67 interval 13 (xid=0xaa3dfb7d)
DHCPDISCOVER on enp0s25 to 255.255.255.255 port 67 interval 21 (xid=0xaa3dfb7d)
DHCPDISCOVER on enp0s25 to 255.255.255.255 port 67 interval 9 (xid=0xaa3dfb7d)
DHCPDISCOVER on enp0s25 to 255.255.255.255 port 67 interval 9 (xid=0xaa3dfb7d)
DHCPDISCOVER on enp0s25 to 255.255.255.255 port 67 interval 11 (xid=0xaa3dfb7d)
DHCPDISCOVER on enp0s25 to 255.255.255.255 port 67 interval 11 (xid=0xaa3dfb7d)
DHCPDISCOVER on enp0s25 to 255.255.255.255 port 67 interval 15 (xid=0xaa3dfb7d)
DHCPDISCOVER on enp0s25 to 255.255.255.255 port 67 interval 11 (xid=0xaa3dfb7d)
DHCPDISCOVER on enp0s25 to 255.255.255.255 port 67 interval 13 (xid=0xaa3dfb7d)
DHCPDISCOVER on enp0s25 to 255.255.255.255 port 67 interval 3 (xid=0xaa3dfb7d)
No DHCPOFFERS received.
No working leases in persistent database – sleeping.
路由输出为空白,并且接口中缺少 eth0 设备,这似乎很奇怪。我该如何连接?谢谢!
答案1
这似乎是 dhcp 问题,您可以尝试运行dhclient -v enp0s25
来获取 ipv4 地址。
您需要在 /etc/network/interfaces 或网络管理器中声明它以使其持久
auto enp0s25
allow-hotplug enp0s25
iface enp0s25 inet dhcp
关于缺少 eth0,这不是一个错误,而是一个功能,因为 2 年来,接口被分配了一个奇怪的名称,你可以通过添加来撤消
GRUB_CMDLINE_LINUX="biosdevname=0 net.ifnames=0"
它/etc/default/grub
最后,fe80::1037:4526:e2b:d5c3 地址是一个链路本地 ipv6 地址,您不能使用它来连接到互联网,但您可以使用它来连接到您的 LAN。
乌巴鲁巴杜布杜布
答案2
部分答案...
从评论和聊天中...
在检查了所有网络设置后,我确信问题出在 Ubuntu 软件安装之外。您的以太网接口看起来确实在工作。DHCP/IPv4/DNS 似乎已损坏。您没有获得 IPv4 地址。最近,我们启动了 Ubuntu Live 16.04 USB,但它也无法连接到互联网。
建议用户向学院 IT 部门提交故障单以寻求解决。
将監視...