2

I accidentally hit return too early when attempting to ping a device, so instead of ping 10.111.12.4 I typed

C:\Users\roadierich>ping 10.111

Pinging 10.0.0.111 with 32 bytes of data:
Request timed out.

I was surprised to see that the IP address was expanded to fill the missing octets.

After further experimentation, I discovered:

ping 1       => ping 0.0.0.1
ping 1.2     => ping 1.0.0.2
ping 1.2.3   => ping 1.2.0.3
ping 1.2.3.4 => ping 1.2.3.4 (as expected)

Based on cursory testing, tracert

I've searched google, but I can't find any reference to this behavior. Is this an actual standard, a defacto standard implemented across every tool taking an I.P. address as an argument, or is it unique to windows?

I know under IPv6 it's acceptable to omit strings of consecutive zeros, but the delimiting characters are still present.

RoadieRich
  • 131
  • 6
  • Yes; The behavior is standard. It is the same reason `0000:0000:0000:0000:0000:0000:0000:0001` an IPv6 address is simply ::1. RFC 791 outlines the entire IPv4 standard, and in turn, explains your discovery – Ramhound May 19 '16 at 18:36
  • @Ramhound Where does RFC 791 define the conventions of textual IP V4 address representation as brought up by the OP? RFC 791 dates back to 1981. [From 2003 to 2005, the necessity of a standardisation of notations was discussed](https://tools.ietf.org/html/draft-main-ipaddr-text-rep-02). Additionally, other effects like [interpreting leading zeroes as octal notation or not also have a practical relevance](http://support.microsoft.com/kb/115388). This doesn't seem to support your point. – Run CMD May 19 '16 at 18:50
  • @Ramhound I can't find anything in there about omitting octets in IPv4. – RoadieRich May 19 '16 at 18:56
  • @ClassStacker - [Except Linux behaves nearly identically](http://stackoverflow.com/questions/10133820/is-there-any-documentation-for-omitting-zeroes-in-dot-decimal-notation-of-ipv4-a) – Ramhound May 19 '16 at 19:13

1 Answers1

0

Standard? No, if by "standard" you mean "is globally expected to work this way".

In this case, Microsoft were doing us a favour (whether intentionally, or because the Windows "ping" authors added extra code because they wanted it).

At any rate, there's an excellent answer at https://superuser.com/a/486936.