Bul*_* M. 2 hostname localhost
我的一部分 /etc/hosts
127.0.0.1 localhost
Run Code Online (Sandbox Code Playgroud)
当我 ping 127.7.7.7 时,它起作用了!
PING 127.7.7.7 (127.7.7.7) 56(84) bytes of data.
64 bytes from 127.7.7.7: icmp_seq=1 ttl=64 time=0.053 ms
64 bytes from 127.7.7.7: icmp_seq=2 ttl=64 time=0.050 ms
64 bytes from 127.7.7.7: icmp_seq=3 ttl=64 time=0.060 ms
Run Code Online (Sandbox Code Playgroud)
但是,ifconfig只显示127.0.0.1,未提及 127.0.0.0/8 子网中的其他地址。
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:19299 errors:0 dropped:0 overruns:0 frame:0
TX packets:19299 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:1858607 (1.8 MB) TX bytes:1858607 (1.8 MB)
Run Code Online (Sandbox Code Playgroud)
你能解释一下为什么任意127.x.x.x地址是“启用”对 ping 的回答,尽管在我看来,它们没有在任何地方明确提及?
IPv4 网络标准保留整个 127.0.0.0/8 地址块用于环回目的。这意味着发送到这 16,777,214 个地址之一(127.0.0.1 到 127.255.255.254)的任何数据包都会被环回。IPv6 只有一个地址,::1。
环回意味着将数据发送到您自己的系统。因此,所有这些地址都指向您自己的系统。
| 归档时间: |
|
| 查看次数: |
1774 次 |
| 最近记录: |