Have you ever seen a system print out an IP address like this?
If you try to ping this IP address you’ll get quite interesting results. What the IP address should be is 10.0.1.133 but what ping reports that it is if you run the command with those leading zeroes included looks very odd.
1 2 3
188.8.131.52 IP address that it is trying to reach? It turns out that if you put leading zeroes into an IP address that you pass to
ping, and possibly other network tools, it treats those numbers as octal. Octal isn’t something most end-users deal with unless they’re reminiscing about their old Compuserve addresses.
In any case, if you find yourself trying to ping a machine with an IP address that has leading zeroes make sure you remove them!
This got me wondering what other weird things ping might do with IP addresses so I played around a bit and saw that it actually allows you to enter them in hex as well. This is useful for IPv6 but really strange for IPv4. Try it out and try to ping the above address with the first octet in hex:
Sure enough it converts
10. I’m not sure I’ll ever use that feature but its good to know what ping does to its input in the even that some other weird situation pops up.