虚拟机ping 通主机却上不了外网
虚拟机系统centos7,
ifconfig 输出
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.80.131 netmask 255.255.255.0 broadcast 192.168.80.255 inet6 fe80::1709:36a9:2bcb:77fc prefixlen 64 scopeid 0x20<link> inet6 fd15:4ba5:5a2b:1008:9d2b:16fb:9e41:1019 prefixlen 64 scopeid 0x0<global> inet6 fd15:4ba5:5a2b:1008:e3e7:e7d:3745:63e2 prefixlen 64 scopeid 0x0<global> ether 00:0c:29:95:f5:aa txqueuelen 1000 (Ethernet) RX packets 2127 bytes 255963 (249.9 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 2095 bytes 213918 (208.9 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10<host> loop txqueuelen 1000 (Local Loopback) RX packets 234 bytes 17140 (16.7 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 234 bytes 17140 (16.7 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255 ether 52:54:00:a5:09:26 txqueuelen 1000 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
traceroute www.baidu.com输出
traceroute to www.baidu.com (180.97.33.107), 30 hops max, 60 byte packets
1 gateway (192.168.80.2) 0.353 ms 0.226 ms 0.211 ms
2 *
3 *
4 *
5 *
6 *
7 *
8 *
9 *
10 *
11 *
12 *
13 *
14 *
同一个网域的win7 tracert www.baidu.com
为什么呢感觉好奇怪,
我感觉ifconfig输出不对。
vim /etc/sysconfig/network-scripts/ifcfg-eth0
TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="static"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
IPV6_ADDR_GEN_MODE="stable-privacy"
NAME="eth0"
UUID="4d1f35b4-4d62-46e6-8f31-64aa66a9d321"
DEVICE="eth0"
ONBOOT="yes"
IPADDR0=192.168.80.131
NETMASK=255.255.255.0
PREFIX0=24
GATEWAY0=192.168.80.2
DNS1=192.168.80.2
"/etc/sysconfig/network-scripts/ifcfg-eth0" 22L, 446C 20,1 All
这里也没有什么不对。
/etc/resolv.conf文件是锁死的,
grep hosts /etc/nsswitch.conf
hosts: files dns myhostname
感谢大家了
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
添加下一跳路由即可。