logoalt Hacker News

dspillett • last Thursday at 5:49 PM • 1 reply • view on HN

However many bytes are used in the scheme, you could in theory use decimal or hexadecimal to represent an address in string form for either scheme. Once the string is unpacked and interpreted, the address is just a number.

Though I've never seen a v6 address represented that way, it would make then noticeably longer, so I don't know if anything will accept such a string as a valid address. Though IPv4-mapped addresses are sometimes show as a mix (::ffff:10.5.2.1 for 10.5.2.1) so maybe I'm wrong there.

Likewise I've never seen IPv4 addresses written in hex in the wild, but the relevant specs say it is valid. `ping 0xc0a82bc2` works just as well as `ping 192.168.43.194` but I doubt many forms accepting IPv4 addresses will validate that and allow it.


Replies

drawkcabdaernac • yesterday at 1:49 PM

I have a script that does takes an IPv6 address and displays it as dotted decimal that I like to bring out any time this discussion pops up. As an example, Facebook's IP address:

  $ ./ipv6todecimal.py 2a03:2880:f366:1:face:b00c:0:25de
  Your IPv6 Address is: 42.3.40.128.243.102.0.1.250.206.176.12.0.0.37.222
Or good old 2600::

  $ ./ipv6todecimal.py 2600::
  Your IPv6 Address is: 38.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0