How to calculate an IP subnetwork with the sipcalc command.

Posted: July 9, 2014. At: 5:21 PM. This was 3 years ago. Post ID: 7500

The sipcalc command is very useful for calculating an IP subnet. This command shows the amount of hosts available for a given subnet.

root@debian:/home/homer# sipcalc 192.168.100.1/24
-[ipv4 : 192.168.100.1/24] - 0
 
[CIDR]
Host address		- 192.168.100.1
Host address (decimal)	- 3232261121
Host address (hex)	- C0A86401
Network address		- 192.168.100.0
Network mask		- 255.255.255.0
Network mask (bits)	- 24
Network mask (hex)	- FFFFFF00
Broadcast address	- 192.168.100.255
Cisco wildcard		- 0.0.0.255
Addresses in network	- 256
Network range		- 192.168.100.0 - 192.168.100.255
Usable range		- 192.168.100.1 - 192.168.100.254

You may also specify the interface that your Linux installation is using. I am using Debian 7.0 in VMware; so this shows the interface IP address as well as the one appended as a command line argument.

root@debian:/home/homer# sipcalc 192.168.100.1/24 eth0
-[ipv4 : 192.168.100.1/24] - 0
 
[CIDR]
Host address		- 192.168.100.1
Host address (decimal)	- 3232261121
Host address (hex)	- C0A86401
Network address		- 192.168.100.0
Network mask		- 255.255.255.0
Network mask (bits)	- 24
Network mask (hex)	- FFFFFF00
Broadcast address	- 192.168.100.255
Cisco wildcard		- 0.0.0.255
Addresses in network	- 256
Network range		- 192.168.100.0 - 192.168.100.255
Usable range		- 192.168.100.1 - 192.168.100.254
 
-
-[int-ipv4 : eth0] - 0
 
[CIDR]
Host address		- 192.168.184.129
Host address (decimal)	- 3232282753
Host address (hex)	- C0A8B881
Network address		- 192.168.184.0
Network mask		- 255.255.255.0
Network mask (bits)	- 24
Network mask (hex)	- FFFFFF00
Broadcast address	- 192.168.184.255
Cisco wildcard		- 0.0.0.255
Addresses in network	- 256
Network range		- 192.168.184.0 - 192.168.184.255
Usable range		- 192.168.184.1 - 192.168.184.254

This is an example that splits an IP address into 8 subnets. This is using a 255.255.255.224 netmask.

deusexmachina ~ # sipcalc -s27 192.168.100.0/24
-[ipv4 : 192.168.100.0/24] - 0
 
[Split network]
Network			- 192.168.100.0   - 192.168.100.31
Network			- 192.168.100.32  - 192.168.100.63
Network			- 192.168.100.64  - 192.168.100.95
Network			- 192.168.100.96  - 192.168.100.127
Network			- 192.168.100.128 - 192.168.100.159
Network			- 192.168.100.160 - 192.168.100.191
Network			- 192.168.100.192 - 192.168.100.223
Network			- 192.168.100.224 - 192.168.100.255

This is an easy way to calculate IP addressing for subnetting. The ipcalc command may also be used for this.

deusexmachina ~ # ipcalc -r 192.168.1.0 192.168.100.255
deaggregate 192.168.1.0 - 192.168.100.255
192.168.1.0/24
192.168.2.0/23
192.168.4.0/22
192.168.8.0/21
192.168.16.0/20
192.168.32.0/19
192.168.64.0/19
192.168.96.0/22
192.168.100.0/24

The above example shows how many subnets you may get with this IP range.

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

Leave a Reply