Tuesday, February 15, 2011

Advanced IP subnet calculator sipcalc

      Sipcalc is an advanced console-based IP subnet calculator. It can take multiple forms of input (IPv4/IPv6/interface/hostname) and output a multitude of information about a given subnet.
 On ubuntu,  you can install it from  software center or from the command line.

If you want to calculate the netmask details of 123.123.123.123/28, here we go

$  sipcalc 123.123.123.123/28
-[ipv4 : 123.123.123.123/28] - 0

[CIDR]
Host address        - 123.123.123.123
Host address (decimal)    - 2071690107
Host address (hex)    - 7B7B7B7B
Network address        - 123.123.123.112
Network mask        - 255.255.255.240
Network mask (bits)    - 28
Network mask (hex)    - FFFFFFF0
Broadcast address    - 123.123.123.127
Cisco wildcard        - 0.0.0.15
Addresses in network    - 16
Network range        - 123.123.123.112 - 123.123.123.127
Usable range        - 123.123.123.113 - 123.123.123.126

Any net admin would love this gem.

You can use it on your existing interfaces too.
Here is the sample ipcalc output from my wlan interface

  # sipcalc -d -bcix -n 4 -e -r -t  wlan0


 [Classfull]
Host address        - 192.168.1.2
Host address (decimal)    - 3232235778
Host address (hex)    - C0A80102
Network address        - 192.168.1.0
Network class        - C
Network mask        - 255.255.255.0
Network mask (hex)    - FFFFFF00
Broadcast address    - 192.168.1.255

[CIDR]
Host address        - 192.168.1.2
Host address (decimal)    - 3232235778
Host address (hex)    - C0A80102
Network address        - 192.168.1.0
Network mask        - 255.255.255.0
Network mask (bits)    - 24
Network mask (hex)    - FFFFFF00
Broadcast address    - 192.168.1.255
Cisco wildcard        - 0.0.0.255
Addresses in network    - 256
Network range        - 192.168.1.0 - 192.168.1.255
Usable range        - 192.168.1.1 - 192.168.1.254
[Classfull bitmaps]
Network address        - 11000000.10101000.00000001.00000000
Network mask        - 11111111.11111111.11111111.00000000

[CIDR bitmaps]
Host address             - 11000000.10101000.00000001.00000010
Network address        - 11000000.10101000.00000001.00000000
Network mask              - 11111111.11111111.11111111.00000000
Broadcast address    - 11000000.10101000.00000001.11111111
Cisco wildcard        - 00000000.00000000.00000000.11111111
Network range        - 11000000.10101000.00000001.00000000 -
                                  11000000.10101000.00000001.11111111
Usable range        - 11000000.10101000.00000001.00000001 -
                                11000000.10101000.00000001.11111110

[Networks]
Network            - 192.168.1.0     - 192.168.1.255 (current)
Network            - 192.168.2.0     - 192.168.2.255
Network            - 192.168.3.0     - 192.168.3.255
Network            - 192.168.4.0     - 192.168.4.255






3 comments:

Bob Robertson said...

Can you put up an IPv6 example?

Martijn said...

$ sipcalc 2001::/8
-[ipv6 : 2001::/8] - 0

[IPV6 INFO]
Expanded Address - 2001:0000:0000:0000:0000:0000:0000:0000
Compressed address - 2001::
Subnet prefix (masked) - 2000:0:0:0:0:0:0:0/8
Address ID (masked) - 1:0:0:0:0:0:0:0/8
Prefix address - ff00:0:0:0:0:0:0:0
Prefix length - 8
Address type - Aggregatable Global Unicast Addresses
Network range - 2000:0000:0000:0000:0000:0000:0000:0000 -
20ff:ffff:ffff:ffff:ffff:ffff:ffff:ffff

-

sia rey said...

CIDR is the short for Classless Inter-Domain Routing, an IP addressing scheme that replaces the older system based on classes A, B, and C. A single IP address can be used to designate many unique IP addresses with CIDR. A CIDR IP address looks like a normal IP address except that it ends with a slash followed by a number, called the IP network prefix. CIDR addresses reduce the size of routing tables and make more IP addresses available within organizations. You can create a random IP address which can then be calculated by using netmask calculator.