解决虚拟机能够ping通本机,但是无法上网问题

来源:互联网 发布:小口径单发枪数据 编辑:程序博客网 时间:2024/05/14 20:36

查看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 0
原创粉丝点击