当前位置: 技术问答>linux和unix
LINUX VMware 上的了外网 DNS可用 可Ping真机和网关 就是Ping不通外网
来源: 互联网 发布时间:2017-04-21
本文导语: 用的是NAT VMnet8的 IPV4是192.168.137.1 所以NAT配的网关是192.168.137.2 NAT采用的是manual ifconfig se1012@ubuntu:~/Desktop/ping$ ifconfig eth0 Link encap:Ethernet HWaddr 00:0c:29:84:cb:6f inet addr:192.168.137.3 Bcast:192....
用的是NAT VMnet8的 IPV4是192.168.137.1
所以NAT配的网关是192.168.137.2 NAT采用的是manual
ifconfig
se1012@ubuntu:~/Desktop/ping$ ifconfig
eth0 Link encap:Ethernet HWaddr 00:0c:29:84:cb:6f
inet addr:192.168.137.3 Bcast:192.168.137.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe84:cb6f/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:20227 errors:0 dropped:0 overruns:0 frame:0
TX packets:9134 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:10610901 (10.6 MB) TX bytes:951134 (951.1 KB)
Interrupt:19 Base address:0x2024
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:16436 Metric:1
RX packets:4087 errors:0 dropped:0 overruns:0 frame:0
TX packets:4087 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:303242 (303.2 KB) TX bytes:303242 (303.2 KB)
route
se1012@ubuntu:~/Desktop/ping$ route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default bogon 0.0.0.0 UG 0 0 0 eth0
link-local * 255.255.0.0 U 1000 0 0 eth0
192.168.137.0 * 255.255.255.0 U 1 0 0 eth0
ping的通真机
se1012@ubuntu:~/Desktop/ping$ ping 192.168.1.56
PING 192.168.1.56 (192.168.1.56) 56(84) bytes of data.
64 bytes from 192.168.1.56: icmp_req=1 ttl=128 time=1.41 ms
64 bytes from 192.168.1.56: icmp_req=2 ttl=128 time=1.32 ms
64 bytes from 192.168.1.56: icmp_req=3 ttl=128 time=1.55 ms
64 bytes from 192.168.1.56: icmp_req=4 ttl=128 time=2.30 ms
64 bytes from 192.168.1.56: icmp_req=5 ttl=128 time=1.47 ms
^C
--- 192.168.1.56 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4006ms
rtt min/avg/max/mdev = 1.326/1.617/2.307/0.353 ms
ping的通网关
se1012@ubuntu:~/Desktop/ping$ ping 192.168.137.2
PING 192.168.137.2 (192.168.137.2) 56(84) bytes of data.
64 bytes from 192.168.137.2: icmp_req=1 ttl=128 time=3.96 ms
64 bytes from 192.168.137.2: icmp_req=2 ttl=128 time=0.324 ms
64 bytes from 192.168.137.2: icmp_req=3 ttl=128 time=0.302 ms
64 bytes from 192.168.137.2: icmp_req=4 ttl=128 time=0.353 ms
^C
--- 192.168.137.2 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3002ms
rtt min/avg/max/mdev = 0.302/1.234/3.960/1.574 ms
为什么ping不通外网啊??
se1012@ubuntu:~/Desktop/ping$ ping www.sina.com
PING polaris.sina.com.cn (202.108.33.60) 56(84) bytes of data.
^C
--- polaris.sina.com.cn ping statistics ---
8 packets transmitted, 0 received, 100% packet loss, time 7000ms
所以NAT配的网关是192.168.137.2 NAT采用的是manual
ifconfig
se1012@ubuntu:~/Desktop/ping$ ifconfig
eth0 Link encap:Ethernet HWaddr 00:0c:29:84:cb:6f
inet addr:192.168.137.3 Bcast:192.168.137.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe84:cb6f/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:20227 errors:0 dropped:0 overruns:0 frame:0
TX packets:9134 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:10610901 (10.6 MB) TX bytes:951134 (951.1 KB)
Interrupt:19 Base address:0x2024
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:16436 Metric:1
RX packets:4087 errors:0 dropped:0 overruns:0 frame:0
TX packets:4087 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:303242 (303.2 KB) TX bytes:303242 (303.2 KB)
route
se1012@ubuntu:~/Desktop/ping$ route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default bogon 0.0.0.0 UG 0 0 0 eth0
link-local * 255.255.0.0 U 1000 0 0 eth0
192.168.137.0 * 255.255.255.0 U 1 0 0 eth0
ping的通真机
se1012@ubuntu:~/Desktop/ping$ ping 192.168.1.56
PING 192.168.1.56 (192.168.1.56) 56(84) bytes of data.
64 bytes from 192.168.1.56: icmp_req=1 ttl=128 time=1.41 ms
64 bytes from 192.168.1.56: icmp_req=2 ttl=128 time=1.32 ms
64 bytes from 192.168.1.56: icmp_req=3 ttl=128 time=1.55 ms
64 bytes from 192.168.1.56: icmp_req=4 ttl=128 time=2.30 ms
64 bytes from 192.168.1.56: icmp_req=5 ttl=128 time=1.47 ms
^C
--- 192.168.1.56 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4006ms
rtt min/avg/max/mdev = 1.326/1.617/2.307/0.353 ms
ping的通网关
se1012@ubuntu:~/Desktop/ping$ ping 192.168.137.2
PING 192.168.137.2 (192.168.137.2) 56(84) bytes of data.
64 bytes from 192.168.137.2: icmp_req=1 ttl=128 time=3.96 ms
64 bytes from 192.168.137.2: icmp_req=2 ttl=128 time=0.324 ms
64 bytes from 192.168.137.2: icmp_req=3 ttl=128 time=0.302 ms
64 bytes from 192.168.137.2: icmp_req=4 ttl=128 time=0.353 ms
^C
--- 192.168.137.2 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3002ms
rtt min/avg/max/mdev = 0.302/1.234/3.960/1.574 ms
为什么ping不通外网啊??
se1012@ubuntu:~/Desktop/ping$ ping www.sina.com
PING polaris.sina.com.cn (202.108.33.60) 56(84) bytes of data.
^C
--- polaris.sina.com.cn ping statistics ---
8 packets transmitted, 0 received, 100% packet loss, time 7000ms
|
hoho,恭喜
我用虚拟机的话,从来不管虚拟机虚拟网卡的IP地址,安装时,选上“桥接”,就可以了
我用虚拟机的话,从来不管虚拟机虚拟网卡的IP地址,安装时,选上“桥接”,就可以了