How to calculate your IPv6 subnet with sipcalc

Tools to manipulate IPv6 addresses : sipcalc

Install in debian 7.x :

apt-get install sipcalc

Usage :

sipcalc -h

sipcalc 1.1.5

Usage: sipcalc [OPTIONS]... <[ADDRESS]... [INTERFACE]... | [-]>

Global options:

-a, --all All possible information.

-d, --resolve Enable name resolution.

-h, --help Display this help.

-I, --addr-int=INT Added an interface.

-n, --subnets=NUM Display NUM extra subnets (starting from

the current subnet). Will display all subnets

in the current /24 if NUM is 0.

-u, --split-verbose Verbose split.

-v, --version Version information.

-4, --addr-ipv4=ADDR Add an ipv4 address.

-6, --addr-ipv6=ADDR Add an ipv6 address.

IPv4 options:

-b, --cidr-bitmap CIDR bitmap.

-c, --classfull-addr Classfull address information.

-i, --cidr-addr CIDR address information. (default)

-s, --v4split=MASK Split the current network into subnets

of MASK size.

-w, --wildcard Display information for a wildcard

(inverse mask).

-x, --classfull-bitmap Classfull bitmap.

IPv6 options:

-e, --v4inv6 IPv4 compatible IPv6 information.

-r, --v6rev IPv6 reverse DNS output.

-S, --v6split=MASK Split the current network into subnets

of MASK size.

-t, --v6-standard Standard IPv6. (default)

Address must be in the "standard" dotted quad format.

Netmask can be given in three different ways:

- Number of bits    [/nn]

- Dotted quad       [nnn.nnn.nnn.nnn]

- Hex               [0xnnnnnnnn | nnnnnnnn]

Interface must be a valid network interface on the system.

If this options is used an attempt will be made to gain the address

and netmask from the specified interface.

Replacing address/interface with '-' will use stdin for reading further

arguments.

Example :

#sipcalc 2001:db8::

-[ipv6 : 2001:db8::] - 0

[IPV6 INFO]

Expanded Address - 2001:0db8:0000:0000:0000:0000:0000:0000

Compressed address - 2001:db8::

Subnet prefix (masked) - 2001:db8:0:0:0:0:0:0/128

Address ID (masked) - 0:0:0:0:0:0:0:0/128

Prefix address - ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff

Prefix length - 128

Address type - Aggregatable Global Unicast Addresses

Network range - 2001:0db8:0000:0000:0000:0000:0000:0000 -

2001:0db8:0000:0000:0000:0000:0000:0000

Very nice for IPv6 reverse :

# sipcalc -r 2001:db8::1
-[ipv6 : 2001:db8::1] - 0

[IPV6 DNS]
Reverse DNS (ip6.arpa)	-
1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.

Very useful if you want subnet for point-to-point subnet /126 :

#sipcalc -S 126 2001:db8:0:1::/64

-[ipv6 : 2001:db8:0:1::/64] - 0

[Split network]
Network                 - 2001:0db8:0000:0001:0000:0000:0000:0000 -
                          2001:0db8:0000:0001:0000:0000:0000:0003
Network                 - 2001:0db8:0000:0001:0000:0000:0000:0004 -
                          2001:0db8:0000:0001:0000:0000:0000:0007
Network                 - 2001:0db8:0000:0001:0000:0000:0000:0008 -
                          2001:0db8:0000:0001:0000:0000:0000:000b
Network                 - 2001:0db8:0000:0001:0000:0000:0000:000c -
                          2001:0db8:0000:0001:0000:0000:0000:000f
Network                 - 2001:0db8:0000:0001:0000:0000:0000:0010 -
                          2001:0db8:0000:0001:0000:0000:0000:0013
...