How to Calculate IP Subnet Address with ipcalc Tool ?
Subnetting is something you’ll have to deal with if you’re doing any kind of moderate to advanced networking. While some people can do the binary math in their heads to figure out the correct subnet-mask, others may find it difficult to calculate. For those people, Ipcalc is a Linux utility that may assist them to compute the number of subnets, the subnetting mask, and other IP addressing-related information.
Ipcalc determines the broadcast, network, Cisco wildcard mask, and host range from an IP address and netmask. You can create subnets and supernets by specifying a second netmask. It’s also meant to be a teaching tool. Therefore, the subnetting results are presented as simple binary values.
- Formats for multiple addresses and netmask output (dotted quad, hex, number of bits).
- Broadcast address, network class, Cisco wildcard, hosts/range, and network range are all output.
- Bitmaps of various types are output.
- A user-defined number of extra networks are output.
- Multiple networks can be accessed using the command line.
- Hostname DNS resolutions.
To install Ipcalc in Ubuntu/Debian-based Linux, open terminal and run the following command:
$ sudo apt-get install ipcalc
How to use Ipcalc?
Use ipcalc to find out everything you need to know about your IP address:
$ ipcalc 192.168.1.27
Calculate a subnet
To calculate subnet for 192.168.1.0/24 use the following command:
$ ipcalc 192.168.1.0/24
Calculate a single subnet with 5 hosts
To calculate a single subnet, use the following command:
$ ipcalc 192.168.1.0 -s 5
Calculate multiple subnets using a single command
Assume you want to split 192.168.1.0 into three subnets, with a total of 50 hosts. In each segment, specify your network mask and the number of hosts.
$ ipcalc 192.168.1.0 -s 10 20 20