natjohan's blog

Posted sam. 21 février 2015

Tip of the week 39

A command line tool for your networking calc : sipcalc

I just want to show you a useful tool for your networking calc called sipcalc, to install it (under debian based, but it should also exists in your favorite distro) :

sudo aptitude install sipcalc

Some examples, here in IPv4 format :

~  sipcalc  192.0.2.0/24
-[ipv4 : 192.0.2.0/24] - 0

[CIDR]
Host address            - 192.0.2.0
Host address (decimal)  - 3221225984
Host address (hex)      - C0000200
Network address         - 192.0.2.0
Network mask            - 255.255.255.0
Network mask (bits)     - 24
Network mask (hex)      - FFFFFF00
Broadcast address       - 192.0.2.255
Cisco wildcard          - 0.0.0.255
Addresses in network    - 256
Network range           - 192.0.2.0 - 192.0.2.255
Usable range            - 192.0.2.1 - 192.0.2.254

You can also split a network with the -s option :

~  sipcalc  192.0.2.0/24 -s 28
-[ipv4 : 192.0.2.0/24] - 0

[Split network]
Network                 - 192.0.2.0       - 192.0.2.15
Network                 - 192.0.2.16      - 192.0.2.31
Network                 - 192.0.2.32      - 192.0.2.47
Network                 - 192.0.2.48      - 192.0.2.63
Network                 - 192.0.2.64      - 192.0.2.79
Network                 - 192.0.2.80      - 192.0.2.95
Network                 - 192.0.2.96      - 192.0.2.111
Network                 - 192.0.2.112     - 192.0.2.127
Network                 - 192.0.2.128     - 192.0.2.143
Network                 - 192.0.2.144     - 192.0.2.159
Network                 - 192.0.2.160     - 192.0.2.175
Network                 - 192.0.2.176     - 192.0.2.191
Network                 - 192.0.2.192     - 192.0.2.207
Network                 - 192.0.2.208     - 192.0.2.223
Network                 - 192.0.2.224     - 192.0.2.239
Network                 - 192.0.2.240     - 192.0.2.255

for IPv6 :

~  sipcalc  2001:DB8::/32
-[ipv6 : 2001:DB8::/32] - 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/32
Address ID (masked)     - 0:0:0:0:0:0:0:0/32
Prefix address          - ffff:ffff:0:0:0:0:0:0
Prefix length           - 32
Address type            - Aggregatable Global Unicast Addresses
Network range           - 2001:0db8:0000:0000:0000:0000:0000:0000 -
                          2001:0db8:ffff:ffff:ffff:ffff:ffff:ffff

Don't forget to read the manual or display the help with '-h' argument.

Note that I used standard IANA IP for documentation in these examples, you can find it int RFC5737 for IPv4 and RFC3849 for IPV6
Category: ToTW
Tags: linux networking tools

Comments