Linux不能上網ping:unknown host問題怎麼解決?

問題:ping 百度沒法ping通,提示unknown hostspa

[root@localhost ~]# ping www.baidu.com
ping: unknown host www.baidu.com.net

 

解決:rest

修改resolv.conf,增長兩個dns地址(我增長的是合肥的),修改前須要鎖定文件server

[root@localhost ~]# vi /etc/resolv.conf
# Generated by NetworkManagerdns


# 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
ip


# DOMAIN=lab.foo.com bar.foo.comget

[root@localhost ~]# chattr +i /etc/resolv.conf百度

保存後重啓網卡
[root@localhost ~]# service NetworkManager restartfile

若是要從新編輯須要先解除鎖定:
[root@localhost ~]# chattr -i /etc/resolv.confnetwork

 

----------

其餘命令: [root@localhost ~]# ifconfig -a [root@localhost ~]# cat  /etc/sysconfig/network-scripts/ifcfg-eth0

相關文章
相關標籤/搜索