侧边栏壁纸
博主头像
落叶人生博主等级

走进秋风,寻找秋天的落叶

  • 累计撰写 130562 篇文章
  • 累计创建 28 个标签
  • 累计收到 9 条评论
标签搜索

目 录CONTENT

文章目录

Linux不能上网ping:unknown host问题怎么解决?

2023-11-17 星期五 / 0 评论 / 0 点赞 / 58 阅读 / 1244 字

问题: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

广告 广告

评论区