ڼС
梦回起点
做你害怕做的事,你会发现:不过如此
本站基于WordPress—主题by 设计窝
冀ICP备15003737号
梦回起点
Copyright © 2015-2018 All rights reserved.

虚拟机下 CentOS 6.x 无法上网问题的解决方法

使用CentOS6.X安装后发现yum命令链接不到服务器,检查发现根本就无法上网,所以找原因

修改eth0配置文件

vi /etc/sysconfig/network-scripts/ifcfg-eth0

引用本地文件内容:

————文件内容—————

DEVICE=”eth0″

HWADDR=”00:0C:29:BD:E1:19″

BOOTPROTO=dhcp

NM_CONTROLLED=”yes”

ONBOOT=”yes”

USECTL=no

TYPE=Ethernet

PEERDNS=yes

———————————–

上面的黄色部分至关重要,是解决问题的根本,设置完成之后我们

service network restart

重启网络服务,如果还没有成功,那么我们重启一下电脑(虚拟机)

reboot

完成上述操作后,我们观察/etc/resolv.conf文件的内容,如下:

image

说明我们的主机现在已经分配到了IP地址,这要归功与最后一条语句,至于解释请参看注释。

注释(英文太水,不敢贸然翻译):

ONBOOT=answer

where answer is one of the following:

  • yes — This device should be activated at boot-time.

  • no — This device should not be activated at boot-time.

PEERDNS=answer

where answer is one of the following:

  • yes — Modify /etc/resolv.conf if the DNS directive is set, if using DHCP, or if using Microsoft’s RFC 1877 IPCP extensions with PPP. In all cases yes is the default.

  • no — Do not modify /etc/resolv.conf.

  •  

参考:https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/s1-networkscripts-interfaces.html

http://blog.csdn.net/ecjtuxuan/article/details/6765094

2016-05-27