我一直在论坛上浏览,似乎找不到适合我的答案。我在虚拟机中运行 Ubuntu 16.04,以 Windows 10 作为主机,通过 NAT 连接到互联网。当我尝试执行 whois 或在网络外 ping 时,我收到错误
$whois google.com
connect: Network is unreachable
dig 和 wget 等工具都可以正常工作,并且我可以通过浏览器访问网络,以下是一些用于调试的常见命令输出
挖:
$dig google.com
; <<>> DiG 9.10.3-P4-Ubuntu <<>> google.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 7759
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; MBZ: 0005 , udp: 4000
;; QUESTION SECTION:
;google.com. IN A
;; ANSWER SECTION:
google.com. 5 IN A 216.58.219.206
;; Query time: 2029 msec
;; SERVER: 127.0.1.1#53(127.0.1.1)
;; WHEN: Wed Feb 01 09:31:49 EST 2017
;; MSG SIZE rcvd: 55
平安:
ping google.com
PING google.com (216.58.219.206) 56(84) bytes of data.
^C
--- google.com ping statistics ---
35 packets transmitted, 0 received, 100% packet loss, time 34075ms
如果配置:
$ifconfig ens33
ens33 Link encap:Ethernet HWaddr 00:0c:29:81:b4:9e
inet addr:192.168.93.137 Bcast:192.168.93.255 Mask:255.255.255.0
inet6 addr: fe80::cb32:1559:ed2e:9968/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:399609 errors:0 dropped:0 overruns:0 frame:0
TX packets:111912 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:318681424 (318.6 MB) TX bytes:17133081 (17.1 MB)
路线
$route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 192.168.93.2 0.0.0.0 UG 100 0 0 ens33
link-local * 255.255.0.0 U 1000 0 0 ens33
192.168.93.0 *
/etc/networking/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
我正在使用 Oh My ZSH,但我认为这不会影响这一点。任何帮助都将不胜感激!