本地网络 - ping 本地 IP 失败

本地网络 - ping 本地 IP 失败

我无法连接到自己的主机,以下是详细信息

debian 是虚拟主机或虚拟盒

grek@debian-dev:~$ ip  addr
1: lo: <LOOPBACK> mtu 16436 qdisc noop state DOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 08:00:27:ca:7c:4d brd ff:ff:ff:ff:ff:ff
    inet6 fe80::a00:27ff:feca:7c4d/64 scope link 
       valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 08:10:27:65:17:4f brd ff:ff:ff:ff:ff:ff
    inet 192.168.56.103/24 brd 192.168.56.255 scope global eth1
    inet6 fe80::a10:27ff:fe65:174f/64 scope link 
       valid_lft forever preferred_lft forever
4: eth2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 08:00:27:e6:da:23 brd ff:ff:ff:ff:ff:ff
    inet 10.0.4.15/24 brd 10.0.4.255 scope global eth2
    inet6 fe80::a00:27ff:fee6:da23/64 scope link 
       valid_lft forever preferred_lft forever



grek@debian-dev:~$ ip route
default via 10.0.4.2 dev eth2  proto static 
10.0.4.0/24 dev eth2  proto kernel  scope link  src 10.0.4.15 
192.168.56.0/24 dev eth1  proto kernel  scope link  src 192.168.56.103 

我的 IP 是 192.168.56.103

grek@debian-dev:~$ ping 192.168.56.103
PING 192.168.56.103 (192.168.56.103) 56(84) bytes of data.
^C
--- 192.168.56.103 ping statistics ---
6 packets transmitted, 0 received, 100% packet loss, time 5039ms

当我尝试从远程机器 ping 它时

C:\Users\g>ping 192.168.56.103

Pinging 192.168.56.103 with 32 bytes of data:
Reply from 192.168.56.103: bytes=32 time=1ms TTL=64
Reply from 192.168.56.103: bytes=32 time<1ms TTL=64

Ping statistics for 192.168.56.103:
    Packets: Sent = 2, Received = 2, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 1ms, Average = 0ms
Control-C

答案1

您的环回接口已关闭......

提出来这个问题ifconfig lo up应该就能解决问题。

Linux 通常会使用环回接口来 ping 自身,因此即使 eth1 具有您正在 ping 的 IP 地址,它仍会在 ping 自身时尝试使用环回。

相关内容