Centos7+ ping www.baidu.com 报错 name or service not know

修改配置

#查看网关
[root@hadoop ~]#  route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.112.2   0.0.0.0         UG    100    0        0 ens33
192.168.112.0   0.0.0.0         255.255.255.0   U     100    0        0 ens33
[root@hadoop ~]# 

[root@hadoop network-scripts]# pwd
/etc/sysconfig/network-scripts
[root@hadoop network-scripts]# vi ifcfg-ens33
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static   #*********注意************#
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=5cde921f-9ae2-4db5-b915-c2ab2cb8ffa9
DEVICE=ens33
ONBOOT=yes
IPADDR=192.168.112.130
NETMASK=255.255.255.0
GATEWAY=192.168.112.2

修改 vi /etc/resolv.conf


[root@hadoop network-scripts]# vi /etc/resolv.conf
# Generated by NetworkManager
nameserver 8.8.8.8
nameserver 114.114.114.114

保存退出,重启网关

[root@hadoop network-scripts]# service network restart
[root@hadoop network-scripts]# ping www.baidu.com
PING www.a.shifen.com (220.181.112.244) 56(84) bytes of data.
64 bytes from 220.181.112.244 (220.181.112.244): icmp_seq=1 ttl=128 time=9.52 ms
64 bytes from 220.181.112.244 (220.181.112.244): icmp_seq=2 ttl=128 time=7.24 ms
64 bytes from 220.181.112.244 (220.181.112.244): icmp_seq=3 ttl=128 time=6.10 ms
^C
--- www.a.shifen.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 6.104/7.624/9.523/1.421 ms
  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值