vim /etc/resolv.conf
# 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
nameserver 8.8.8.8
nameserver 8.8.4.4
service network restart
刚才添加的DNS没有了
解决方案:
运行chattr +i /etc/resolv.conf
再重启service network restart
可以了。。。。。。。
可以ping www.baidu.com