问题:ping 百度无法ping通,提示unknown host [root@localhost ~]# ping www.baidu.com ping: unknown host www.baidu
问题:ping 百度无法ping通,提示unknown host
[root@localhost ~]# ping www.baidu.com
ping: unknown host www.baidu.com
解决:
修改resolv.conf,增加两个dns地址(我增加的是合肥的),修改前需要锁定文件
[root@localhost ~]# vi /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
nameserver 202.102.192.68
nameserver 202.102.199.68
# DOMAIN=lab.foo.com bar.foo.com
[root@localhost ~]# chattr +i /etc/resolv.conf
保存后重启网卡
[root@localhost ~]# service NetworkManager restart
如果要重新编辑需要先解除锁定:
[root@localhost ~]# chattr -i /etc/resolv.conf
----------
其他命令:
[root@localhost ~]# ifconfig -a
[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0