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

猜你喜欢

转载自blog.csdn.net/liruizi/article/details/84547768
今日推荐