Calculate subnets with the Linux command line and sipcalc.

Posted: April 29, 2015. At: 12:38 PM. This was 2 years ago. Post ID: 8162

The sipcalc utility for Linux is used to calculate subnets for IP addresses. The below example shows a /26 address and the available IP addresses and number of network nodes in the subnet. This is a good way to calculate the network mask if the network administrator requires this information to input it into a Cisco router. Instead of using binary to decimal conversion to achieve this.

ubuntu ~ $ sipcalc 172.16.0.1/26
-[ipv4 : 172.16.0.1/26] - 0
 
[CIDR]
Host address            - 172.16.0.1
Host address (decimal)  - 2886729729
Host address (hex)      - AC100001
Network address         - 172.16.0.0
Network mask            - 255.255.255.192
Network mask (bits)     - 26
Network mask (hex)      - FFFFFFC0
Broadcast address       - 172.16.0.63
Cisco wildcard          - 0.0.0.63
Addresses in network    - 64
Network range           - 172.16.0.0 - 172.16.0.63
Usable range            - 172.16.0.1 - 172.16.0.62

Compare this with a /24 address. There are 256 addresses available instead of 64. Splitting a network into subnets allows the segregation of the network into various secure networks to separate one network from another to greatly improve network security.

ubuntu ~ $ sipcalc 172.16.0.1/24
-[ipv4 : 172.16.0.1/24] - 0
 
[CIDR]
Host address            - 172.16.0.1
Host address (decimal)  - 2886729729
Host address (hex)      - AC100001
Network address         - 172.16.0.0
Network mask            - 255.255.255.0
Network mask (bits)     - 24
Network mask (hex)      - FFFFFF00
Broadcast address       - 172.16.0.255
Cisco wildcard          - 0.0.0.255
Addresses in network    - 256
Network range           - 172.16.0.0 - 172.16.0.255
Usable range            - 172.16.0.1 - 172.16.0.254

Type man sipcalc to get more information on this very useful utility.

No comments have been made. Use this form to start the conversation :)

Leave a Reply