Posted: . At: 12:38 PM. This was 9 years ago. Post ID: 8162
Page permalink. WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters.
These cookies expire two weeks after they are set.

Calculate subnets with the Linux command line and sipcalc.

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.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.