Skip to content

Comment on Ipcalc – Command line CIDR calculator with IPv6 support

Comments

Any idea why it doesn't give a HostMin/HostMax/Hosts field when passing an IPv6 range?

  $ ipcalc 2600:1ff2:4000::/40
  Address: 2600:1ff2:4000::                        0010011000000000:0001111111110010:0100000000000000:0000000000000000:0000000000000000:0000000000000000:0000000000000000:0000000000000000
  Netmask: 40                                      1111111111111111:1111111111111111:1111111100000000:0000000000000000:0000000000000000:0000000000000000:0000000000000000:0000000000000000
  Prefix:  2600:1ff2:4000::/40                     0010011000000000:0001111111110010:0100000000000000:0000000000000000:0000000000000000:0000000000000000:0000000000000000:0000000000000000

shameless plug, I made an ipcalc6 in rust that does it (with colors)

https://github.com/ba9f11ecc3497d9993b933fdc2bd61e5/ipcalc6

user@box:~/Documents/code/rust/ipcalc6$ cargo run 2600:1ff2:4000::/40

    Finished dev [unoptimized + debuginfo] target(s) in 0.01s

     Running `target/debug/ipcalc6 '2600:1ff2:4000::/40'`

WARNING : netmask /40 is smaller than /48, this is unusual if ip of type : Global Unicast Address and Link-Local Address

Type: Unicast Global

Address: 2600:1ff2:4000:0000:0000:0000:0000:0000

NetMask: 40

Hosts/Net: 19342813113834066795298816

Address: 0010011000000000.0001111111110010.0100000000000000.0000000000000000.0000000000000000.0000000000000000.0000000000000000.0000000000000000

NetMask: 1111111111111111.1111111111111111.1111111111111111.0000000000000000.0000000000000000.0000000000000000.0000000000000000.0000000000000000

HostMin: 0010011000000000.0001111111110010.0100000000000000.0000000000000000.0000000000000000.0000000000000000.0000000000000000.0000000000000000

HostMax: 0010011000000000.0001111111110010.0100000000000000.1111111111111111.1111111111111111.1111111111111111.1111111111111111.1111111111111111

"HostMin" = Prefix.

"HostMax" = Prefix followed by all f's.

"Hosts" = some ungodly large number (i.e. "small" for this is 2^64) you typically don't care about anymore.

If someone did something atypical like use a /123 (mask >64, mask not a multiple of 4) and you do actually want to see host max and host count as a result you can pass "--all-info". Otherwise a combination of the ridiculous size and hex encoding makes everything but "what is the prefix and netmask" irrelevant.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.