Ubuntu 16.04 中目标主机不可达且网关 0.0.0.0

Ubuntu 16.04 中目标主机不可达且网关 0.0.0.0

我安装了 Ubuntu 16.04,但无法获得有线互联网连接。桌面仅运行 Ubuntu,尚未设置无线连接。为了排除故障,我使用了https://ubuntuforums.org/showthread.php?t=2353825https://ubuntuforums.org/showthread.php?t=2346164编辑我的 /etc/network/interfaces文件,但仍然无法上网。有什么办法可以解决这个问题吗?

提前致谢!

系统信息

$ more /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

$ lspci -nnk | grep -iA2 eth
00:1f.6 Ethernet controller [0200]: Intel Corporation Ethernet Connection (2) I219-LM [8086:15b7] (rev 31)
    Subsystem: Dell Ethernet Connection (2) I219-LM [1028:06c7]
    Kernel driver in use: e1000e
    Kernel modules: e1000e

$ ifconfig
enp0s31f6 Link encap:Ethernet  HWaddr d8:9e:f3:14:7d:5c  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:16 Memory:f7000000-f7020000 

enp0s31f6:avahi Link encap:Ethernet  HWaddr d8:9e:f3:14:7d:5c  
          inet addr:169.254.7.129  Bcast:169.254.255.255  Mask:255.255.0.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          Interrupt:16 Memory:f7000000-f7020000 

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:1662035 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1662035 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:123743544 (123.7 MB)  TX bytes:123743544 (123.7 MB)

网关是 0.0.0.0

$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         0.0.0.0         0.0.0.0         U     1002   0        0 enp0s31f6
169.254.0.0     0.0.0.0         255.255.0.0     U     0      0        0 enp0s31f6

$ netstat -r
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
default         *               0.0.0.0         U         0 0          0 enp0s31f6
link-local      *               255.255.0.0     U         0 0          0 enp0s31f6

ping 返回“目标主机不可达”

$ ping 169.254.7.0
PING 169.254.7.0 (169.254.7.0) 56(84) bytes of data.
From 169.254.7.129 icmp_seq=1 Destination Host Unreachable

$ ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
From 169.254.7.129 icmp_seq=1 Destination Host Unreachable
From 169.254.7.129 icmp_seq=2 Destination Host Unreachable

$ ping google.com
ping: unknown host google.com

编辑

$ sudo ifdown enp0s31f6 && sudo ifup -v enp0s31f6
Killed old client process
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/d8:9e:f3:14:7d:5c
Sending on   LPF/enp0s31f6/d8:9e:f3:14:7d:5c
Sending on   Socket/fallback
Configuring interface enp0s31f6=enp0s31f6 (inet)
/bin/run-parts --exit-on-error --verbose /etc/network/if-pre-up.d
run-parts: executing /etc/network/if-pre-up.d/ethtool
run-parts: executing /etc/network/if-pre-up.d/wireless-tools
run-parts: executing /etc/network/if-pre-up.d/wpasupplicant

/sbin/dhclient -1 -v -pf /run/dhclient.enp0s31f6.pid -lf /var/lib/dhcp/dhclient.enp0s31f6.leases -I -df /var/lib/dhcp/dhclient6.enp0s31f6.leases 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/d8:9e:f3:14:7d:5c
Sending on   LPF/enp0s31f6/d8:9e:f3:14:7d:5c
Sending on   Socket/fallback
DHCPDISCOVER on enp0s31f6 to 255.255.255.255 port 67 interval 3 (xid=0x97131a3b)
DHCPDISCOVER on enp0s31f6 to 255.255.255.255 port 67 interval 4 (xid=0x97131a3b)

相关内容