cli tools to assist you in subnetting a network

If your into networking you should be able to do all subnetting without any tools but sometimes human error can creep up or you just want things done quickly

These are the command line interface tools I found helpful for subnetting:

  1. sipcalc
    
    guru@home:~$ sipcalc --help
    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.
    
    Report bugs to <simon@routemeister.net>.
    

    so for example you want to understand the Global Unicast Address range

    guru@home:~$ sipcalc -a -6 2000::/3
    -[ipv6 : 2000::/3] - 0
    
    [IPV6 INFO]
    Expanded Address	- 2000:0000:0000:0000:0000:0000:0000:0000
    Compressed address	- 2000::
    Subnet prefix (masked)	- 2000:0:0:0:0:0:0:0/3
    Address ID (masked)	- 0:0:0:0:0:0:0:0/3
    Prefix address		- e000:0:0:0:0:0:0:0
    Prefix length		- 3
    Address type		- Aggregatable Global Unicast Addresses
    Network range		- 2000:0000:0000:0000:0000:0000:0000:0000 -
    			  3fff:ffff:ffff:ffff:ffff:ffff:ffff:ffff
    
    [V4INV6]
    Expanded v4inv6 address	- 2000:0000:0000:0000:0000:0000:0.0.0.0
    Compr. v4inv6 address	- 2000::0.0.0.0
    
    [IPV6 DNS]
    Reverse DNS (ip6.arpa)	-
    0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.ip6.arpa.
    
    -
    
    

    Or say you want to know the range of the subnets for a given IP address and you want 4 including the one for which you provide the IP (you can leave the -a option)

    e.g. 10.6.14.4/20

    guru@home:~$ sipcalc -a -n4 10.5.14.4/20
    -[ipv4 : 10.5.14.4/20] - 0
    
    [Classfull]
    Host address		- 10.5.14.4
    Host address (decimal)	- 168103428
    Host address (hex)	- A050E04
    Network address		- 10.0.0.0
    Network class		- A
    Network mask		- 255.0.0.0
    Network mask (hex)	- FF000000
    Broadcast address	- 10.255.255.255
    
    [CIDR]
    Host address		- 10.5.14.4
    Host address (decimal)	- 168103428
    Host address (hex)	- A050E04
    Network address		- 10.5.0.0
    Network mask		- 255.255.240.0
    Network mask (bits)	- 20
    Network mask (hex)	- FFFFF000
    Broadcast address	- 10.5.15.255
    Cisco wildcard		- 0.0.15.255
    Addresses in network	- 4096
    Network range		- 10.5.0.0 - 10.5.15.255
    Usable range		- 10.5.0.1 - 10.5.15.254
    
    [Classfull bitmaps]
    Network address		- 00001010.00000000.00000000.00000000
    Network mask		- 11111111.00000000.00000000.00000000
    
    [CIDR bitmaps]
    Host address		- 00001010.00000101.00001110.00000100
    Network address		- 00001010.00000101.00000000.00000000
    Network mask		- 11111111.11111111.11110000.00000000
    Broadcast address	- 00001010.00000101.00001111.11111111
    Cisco wildcard		- 00000000.00000000.00001111.11111111
    Network range		- 00001010.00000101.00000000.00000000 -
    			  00001010.00000101.00001111.11111111
    Usable range		- 00001010.00000101.00000000.00000001 -
    			  00001010.00000101.00001111.11111110
    
    [Networks]
    Network			- 10.5.0.0        - 10.5.15.255 (current)
    Network			- 10.5.16.0       - 10.5.31.255
    Network			- 10.5.32.0       - 10.5.47.255
    Network			- 10.5.48.0       - 10.5.63.255
    
    
    
  2. bindechexascii
    (handy for teachers)

    guru@home:~$ bindechexascii --help
    
    Usage: bindechexascii [mode] arg1 arg2 arg3 ...
    
    Convert:
     --b2d     Binary to decimal
     --b2h     Binary to hexadecimal
     --b2a     Binary to ASCII
    
     --d2b     Decimal to binary
     --d2h     Decimal to hexadecimal
     --d2a     Decimal to ASCII
    
     --h2b     Hexadecimal to binary
     --h2d     Hexadecimal to decimal
     --h2a     Hexadecimal to ASCII
    
     --a2b     ASCII to binary
     --a2d     ASCII to decimal
     --a2h     ASCII to hexadecimal
    
     -h --help    Print this help
     -i --info    Print information about program
    
    guru@home:~$ bindechexascii --h2b 2001 FE80
    Hexadecimal to Binary: 0010000000000001 1111111010000000
    
    guru@home:~$ bindechexascii --d2h 192 168 4 66
    Decimal to Hexadecimal: C0 A8 4 42 
    
  3. subnetcalc

    Usage:
    subnetcalc [Address{/{Netmask|Prefix}}] {Netmask|Prefix} {-n} {-uniquelocal|-uniquelocalhq}

    guru@home:~$ subnetcalc 2001:fe80:ABCD:EF::/64
    Address       = 2001:fe80:abcd:ef::
                       2001 = 00100000 00000001
                       fe80 = 11111110 10000000
                       abcd = 10101011 11001101
                       00ef = 00000000 11101111
                       0000 = 00000000 00000000
                       0000 = 00000000 00000000
                       0000 = 00000000 00000000
                       0000 = 00000000 00000000
    Network       = 2001:fe80:abcd:ef:: / 64
    Netmask       = ffff:ffff:ffff:ffff::
    Wildcard Mask = ::ffff:ffff:ffff:ffff
    Hosts Bits    = 64
    Max. Hosts    = 18446744073709551616   (2^64 - 1)
    Host Range    = { 2001:fe80:abcd:ef::1 - 2001:fe80:abcd:ef:ffff:ffff:ffff:ffff }
    Properties    =
       - 2001:fe80:abcd:ef:: is a NETWORK address
       - Global Unicast Properties:
          + Interface ID = 0000:0000:0000:0000
          + Sol. Node MC = ff02::1:ff00:0000
    GeoIP Country = Unknown (??)
    DNS Hostname  = (Name or service not known)
    
    

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s