vwware虚拟机无法连接外网
Posted qian@@jing
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了vwware虚拟机无法连接外网相关的知识,希望对你有一定的参考价值。
问题:动态IP时连接外网没有问题,但是将IP改为静态IP时发现没有办法连接外网
查看文件/etc/resolv.conf,里面的内容全部都被注释
[[email protected] network-scripts]# more /etc/resolv.conf
# Generated by NetworkManager
# No nameservers found; try putting DNS servers into your
# ifcfg files in /etc/sysconfig/network-scripts like so:
#
# DNS1=xxx.xxx.xxx.xxx
# DNS2=xxx.xxx.xxx.xxx
# DOMAIN=lab.foo.com bar.foo.com
在eth0文件中增加一行语句
[[email protected] network-scripts]# vi ifcfg-eth0
DEVICE=eth0
BOOTPROTO=none
#BOOTPROTO=dhcp
IPADDR=192.168.0.173
IPV6INIT=no
NM_CONTROLLED=yes
ONBOOT=yes
TYPE=Ethernet
UUID="9086dd6f-6c00-49be-ad52-28ab87f2dcb7"
NAME="System eth0"
HWADDR=00:0c:29:c2:96:4a
NETMASK=255.255.255.0
GATEWAY=192.168.0.1
USERCTL=no
DNS1=192.168.0.1
重启network
[[email protected] network-scripts]# service network restart
Shutting down interface eth0: Device state: 3 (disconnected)
[ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0: Active connection state: activated
Active connection path: /org/freedesktop/NetworkManager/ActiveConnection/5
[ OK ]
可以连接外网
[[email protected] network-scripts]# ping www.baidu.com
PING www.a.shifen.com (61.135.169.121) 56(84) bytes of data.
64 bytes from 61.135.169.121: icmp_seq=1 ttl=54 time=2.51 ms
再次查看/etc/resolv.conf文件
[[email protected] network-scripts]# more /etc/resolv.conf
# Generated by NetworkManager
nameserver 192.168.0.1
以上是关于vwware虚拟机无法连接外网的主要内容,如果未能解决你的问题,请参考以下文章
hyper-v虚拟机无法上外网,但与宿主机之间可以ping通。
hyper-V下虚拟机连接外网,怎么才能将Hyper-V 的虚拟机接入互联网