可以建立连接,但仍然得到“连接:网络无法访问”

sal*_*owl 5 networking internet connection asus

我有一台华硕 E402NA 笔记本电脑。我在其上安装了 Ubuntu 16.04。在安装结束时,安装程​​序崩溃了,但我仍然能够引导和启动 Ubuntu(不确定这是否是有用的信息,但这不是我现在关心的问题)。

我可以看到 wifi 网络,我可以连接(它会检测我是否使用了错误的密码)。当它建立时,我看到一个连接。但是,当我尝试上网时,我无法访问任何站点,也无法 ping 任何内容:

$ ping 192.168.0.1
connect: Network is unreachable

$ ping 8.8.8.8
connect: Network is unreachable
Run Code Online (Sandbox Code Playgroud)

我尝试使用以太网连接,但效果是一样的。它告诉我已建立连接,但任何 ping 尝试都得到相同的结果。当我启动到实时 USB 时也会发生同样的情况,所以我认为这与安装没有任何关系。我尝试运行 Debian 9.5.0 live usb,当我通过以太网连接时发生了同样的事情。同样用于运行 Ubuntu 16.04 live usb。

以下是我在已安装的 Ubuntu 16.04 上运行的一些命令的输出: 我在连接到 wifi 网络时运行 netstat。

$ netstat -natp
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      1336/cupsd      
tcp6       0      0 ::1:631                 :::*                    LISTEN      1336/cupsd 

$ ifconfig -a
enp1s0f2  Link encap:Ethernet  HWaddr 60:45:cb:bf:bd:2e  
          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)

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:6836 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6836 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:507456 (507.4 KB)  TX bytes:507456 (507.4 KB)

wlp2s0    Link encap:Ethernet  HWaddr f0:03:8c:8f:5d:15  
          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)

$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

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

$ cat /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
Run Code Online (Sandbox Code Playgroud)

编辑:运行时sudo dhclient -v

$ sudo dhclient -v
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/wlp2s0/f0:03:8c:8f:5d:15
Sending on   LPF/wlp2s0/f0:03:8c:8f:5d:15
Listening on LPF/enp1s0f2/60:45:cb:bf:bd:2e
Sending on   LPF/enp1s0f2/60:45:cb:bf:bd:2e
Sending on   Socket/fallback
DHCPDISCOVER on wlp2s0 to 255.255.255.255 port 67 interval 3 (xid=0x995990e)
Unable to set up timer: out of range

If you think you have received this message due to a bug rather
than a configuration issue please read the section on submitting
bugs on either our web page at www.isc.org or in the README file
before submitting a bug.  These pages explain the proper
process and the information we find helpful for debugging..

exiting.
Run Code Online (Sandbox Code Playgroud)

ste*_*ver 6

根据您的ifconfig输出,连接似乎是在OSI 链路层建立的,但该接口未分配 IP 地址。

对此有几种可能的解释 - 例如:

  • 您的网络不使用 DHCP(暗示任何其他设备都配置了静态 IP 地址)
  • 您的网络配置为使用 DHCP,但 DHCP 服务器未向该设备提供地址(可能是由于基于 MAC 的白名单或黑名单)
  • 防火墙阻止 DHCP 工作(禁止 DHCP 发现数据包退出客户端,或禁止 DHCP 响应到达它)

来自的详细输出sudo dhclient -v确认您的客户端至少正在启动 DHCP 发现阶段 - 但是它突然终止并出现神秘错误

Unable to set up timer: out of range
Run Code Online (Sandbox Code Playgroud)

谷歌搜索这个特定的错误导致我们得到以下错误报告isc-dhcp-client: Error 'Unable to set up timer: out of range' when system time too far in future,这表明问题是 DHCP 客户端在系统的硬件时钟与 DHCP 服务器的时钟不一致。

更正时钟偏移应该可以解决问题。