I know IPv6 allows consecutive zeros to be omitted. But how about IPv4? I haven't found any reference to this on the Internet, including Wikipedia and RFC 791 – Internet Protocol. This document suggests that "Leading zeros can be omitted" in an IPv4 address (search for the term 'omitted'). Not specific enough.
Check out this shell session:
[~]$ ping -c 1 127.1
PING 127.1 (127.0.0.1) 56(84) bytes of data.
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.040 ms
--- 127.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.040/0.040/0.040/0.000 ms
[~]$ ping -c 1 127.0.1
PING 127.0.1 (127.0.0.1) 56(84) bytes of data.
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.044 ms
--- 127.0.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.044/0.044/0.044/0.000 ms
[~]$ ssh 127.1 :
The authenticity of host '127.1 (127.0.0.1)' can't be established.
ECDSA key fingerprint is 04:48:fa:f2:ef:95:7c:35:46:39:2e:d3:89:dd:cd:87.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '127.1' (ECDSA) to the list of known hosts.
[email protected]'s password:
Clearly, both ping and ssh understand 127.1 and 127.0.1 to be the same as 127.0.0.1. Where is this specified?
ping 0.0.0.0
orping 0
works the same way...)