すべてのループバックアドレスをpingできません。

すべてのループバックアドレスをpingできません。

私たちが知っているように、ループバックアドレス範囲は127.0.0.0 - 127.255.255.255です。私のLinuxコンピュータでは、127.0.0.1、127.0.0.2、127.0.0.254などの任意のアドレス(つまり、127.0.0.1から127.0.0.254までのすべてのアドレス)をpingできます。ただし、127.0.1.1などの他のアドレスはpingできません。 (しかし私のWindows 10ノートブックでは動作します。)誰かがこれを説明できますか?

ベストアンサー1

ブロック127.0.0.0/8がループバック用に予約されているとしても、コンピュータがブロック全体に対して構成されているわけではありません。

たとえば、私のLinuxデスクトップでは、次のようになります。

root:~# ifconfig |grep '127.'
        inet 127.0.0.1  netmask 255.0.0.0
root:~# ping -c 1 127.1.1.1
PING 127.1.1.1 (127.1.1.1) 56(84) bytes of data.
64 bytes from 127.1.1.1: icmp_seq=1 ttl=64 time=0.035 ms

--- 127.1.1.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.035/0.035/0.035/0.000 ms
root:~# ifconfig lo 127.0.0.1 netmask 255.255.255.0
root:~# ping -c 1 127.1.1.1
PING 127.1.1.1 (127.1.1.1) 56(84) bytes of data.

--- 127.1.1.1 ping statistics ---
1 packets transmitted, 0 received, 100% packet loss, time 0ms

これは、インターフェイスのlo設定方法、特にネットワークマスクによって異なります。

おすすめ記事