有人可以帮我修复8.8.8.8
在 CentOS 7 中执行 ping 时出现目标不可达错误吗?
当网络类型为 DHCP 时,它工作正常。你能帮我吗?我是 Linux 新手。以下是详细信息。
操作系统:CentOS 7
TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPADDR=192.168.1.23
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
NAME=Test
UUID=f7cc64f5-1b39-448f-9282-53dde8d5d85f
ONBOOT=yes
HWADDR=00:0C:29:EB:E4:27
PEERDNS=no
PEERROUTES=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
内容resolve.conf
:
nameserver 192.168.1.1
nameserver 8.8.8.8
etc-sysconfig-网络:
NETWORKING=yes
HOSTNAME=puppet.test
GATEWAY=192.168.1.1
更新:我得到了网关和 nslookup 的以下输出
[root@puppet ~]# ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
From 192.168.1.129 icmp_seq=1 Destination Host Unreachable
From 192.168.1.129 icmp_seq=2 Destination Host Unreachable
^C
--- 192.168.1.1 ping statistics ---
4 packets transmitted, 0 received, +2 errors, 100% packet loss, time 3012ms
pipe 2
[root@puppet ~]# ping ^C
[root@puppet ~]# nslookup www.purple.com 8.8.8.8
;; connection timed out; trying next origin
;; connection timed out; no servers could be reached
输出ifconfig
:
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.129 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::20c:29ff:fe8e:6900 prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:8e:69:00 txqueuelen 1000 (Ethernet)
RX packets 126 bytes 17135 (16.7 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 403 bytes 31235 (30.5 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 0 (Local Loopback)
RX packets 841 bytes 79599 (77.7 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 841 bytes 79599 (77.7 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
答案1
从您的反馈来看,接口似乎已启动,所以这不是问题所在?
如果你自己创建了 resolve.conf,而且这不是拼写错误,那么问题可能在于它的正确名称是解析配置文件? 您可以从终端像这样重命名:
cd /etc
mv resolve.conf resolv.conf
然后再次尝试 ping。
否则,尝试删除网关作为 DNS 服务器,并将 resolv.conf 的内容替换为:
名称服务器 8.8.8.8
名称服务器 8.8.4.4
?
答案2
我将虚拟机设置从 NAT 更改为桥接网络,它开始工作了。感谢您的帮助。
[root@puppet ~]# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=55 time=24.2 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=55 time=18.8 ms