3 ms·
127.1 is the same as 127.0.0.1. 0 bytes are inserted based on the following: x -> 0.0.0.x x.y -> x.0.0.y x.y.z -> x.y.0.z
by Jtsummers 2y ago
127.1 is the same as 127.0.0.1. 0 bytes are inserted based on the following:
x -> 0.0.0.x
x.y -> x.0.0.y
x.y.z -> x.y.0.z
- bryanlarsen 2y agoBut sometimes 127.1 means 127.1.0.0/16. For example in the output of `netstat -rn` on MacOS.
- Jtsummers 2y agoGood to know. I was also coming back in to edit my comment and write that my x -> 0.0.0.x was technically wrong and the same for the others. If you stick to only single-byte values then what I wrote was correct but if the values span multiple bytes they fill in the missing 0s appropriately, as in: 256 -> 0.0.1.0 1.256 -> 1.0.1.0
- elcritch 2y agoSimilar rules apply to ipv6 addresses as well.
- jandrese 2y agoIPv6 at least sensibly has a different delimiter for when you are eliding zeros.
- moefh 2y agoIt's not really about eliding zeros, though. It's kind of a cursed thing: x -> x3.x2.x1.x0 x.y -> x.y2.y1.y0 x.y.z -> x. y.z1.z0 x.y.z.w -> x. y. z. w Where x0 is the 8 least significant bits of x, x1 is the next 8 higher bits, and so on. The "zeros" happen when the last number is smaller than 256 (or 65536, etc.), but it doesn't have to be. For example 10.258 is a valid way to write an IPv4 address, it's the same as 10.0.1.2.
- ice3 2y agoHere's a cursed way of writing an ip address: 0xA.024.7720 where 0xA is hex, 024 is octal and last 2 octets are written as a decimal number