解决虚拟机能够ping通本机,但是无法上网问题
查看centos网关是否设置正确[root@localhost ethan]# grep GATEWAY /etc/sysconfig/network-scripts/ifcfg*/etc/sysconfig/network-scripts/ifcfg-eth0:GATEWAY=192.168.199.1不正确就设置:[root@localhost ethan]#vim
查看centos网关是否设置正确
[root@localhost ethan]# grep GATEWAY /etc/sysconfig/network-scripts/ifcfg*
/etc/sysconfig/network-scripts/ifcfg-eth0:GATEWAY=192.168.199.1
不正确就设置:
[root@localhost ethan]#vim /etc/resolv.conf 如下:
nameserver 192.168.15.1 --此处为VMWare中配置的网关
search localdomain
设置网关:
[root@localhost ethan]#vim /etc/sysconfig/network 如下:
NETWORKING=yes
HOSTNAME=localhost.localdomain
GATEWAY=192.168.15.1
[root@localhost ethan]# vim /etc/sysconfig/network-scripts/ifcfg-eth0 如下:
TYPE=Ethernet
BOOTPROTO=static
DEVICE=eth0
IPADDR=192.168.199.213
NETMASK=255.255.255.0
ONBOOT=yes
GATEWAY=192.168.199.1
4.最后重启网络服务
service network restart
更多推荐
所有评论(0)