How to install Subnetcalc in Ubuntu

To install Subnetcalc on Ubuntu for Subnet Address Calculation

Subnetcalc is a command line Subnet Address Calculator application. It calculates IPV4 and IPV6 subnet addresses. It provides the information of binary value of IP, broadcast addresses, network addresses and the number of host. Installation of Subnetcalc is explained in this manual.

Run the following command to add PPA repository before installing the subnetcalc.

root@linuxhelp:~# add-apt-repository ppa:dreibh/ppa  
This is Thomas Dreibholz' s software repository. It contains the following packages:
- rsplib - The Open Source implementation of Reliable Server Pooling (RSerPool)
URL: http://tdrwww.iem.uni-due.de/dreibholz/rserpool/
- sctplib/socketapi - An userland SCTP implementation
URL: http://www.sctp.de/sctp.html
- subnetcalc - An IPv4/IPv6 subnet calculator
URL: http://www.iem.uni-due.de/~dreibh/subnetcalc/
- netperfmeter - A network performance meter for UDP, TCP, SCTP and DCCP
URL: http://www.iem.uni-due.de/~dreibh/netperfmeter/
- bibtexconv - A BibTeX entry export tool
.
.
.
gpg: keyring `/tmp/tmp6rlwtx46/secring.gpg'  created
gpg: keyring `/tmp/tmp6rlwtx46/pubring.gpg'  created
gpg: requesting key 916C56E0 from hkp server keyserver.ubuntu.com
gpg: /tmp/tmp6rlwtx46/trustdb.gpg: trustdb created
gpg: key 916C56E0: public key " Launchpad PPA for Thomas Dreibholz"  imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
OK


Update the system repository by running the following command.

root@linuxhelp:~# apt-get update 
Hit http://security.ubuntu.com wily-security InRelease
Hit http://in.archive.ubuntu.com wily InRelease                        
Get:1 http://ppa.launchpad.net wily InRelease [15.4 kB]                                     
.
.
.
Hit http://in.archive.ubuntu.com wily-backports/multiverse amd64 Packages                                                                                                  
Hit http://in.archive.ubuntu.com wily-backports/main i386 Packages                                                                                                         
Hit http://in.archive.ubuntu.com wily-backports/restricted i386 Packages                                                                                                   
Hit http://in.archive.ubuntu.com wily-backports/universe i386 Packages                                                                                                     
Hit http://in.archive.ubuntu.com wily-backports/multiverse i386 Packages                                                                                                   
Hit http://in.archive.ubuntu.com wily-backports/main Translation-en                                                                                                        
Hit http://in.archive.ubuntu.com wily-backports/multiverse Translation-en                                                                                                  
Hit http://in.archive.ubuntu.com wily-backports/restricted Translation-en                                                                                                  
Hit http://in.archive.ubuntu.com wily-backports/universe Translation-en                                                                                                    
Fetched 61.1 kB in 18s (3,216 B/s)                                                                                                                                         
Reading package lists... Done


Run the following command to install Subnetcalc.

root@linuxhelp:~# apt-get install subnetcalc -y  
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  chrpath libcpprspserver2 librsplib2 libsctp1 lksctp-tools rsplib-docs rsplib-fgp-cfgfiles rsplib-legacy-wrappers rsplib-tools traceroute whois
The following NEW packages will be installed:
  chrpath libcpprspserver2 librsplib2 libsctp1 lksctp-tools rsplib-docs rsplib-fgp-cfgfiles rsplib-legacy-wrappers rsplib-tools subnetcalc traceroute whois
0 upgraded, 12 newly installed, 0 to remove and 252 not upgraded.
Need to get 1,156 kB of archives.
After this operation, 2,501 kB of additional disk space will be used.
Get:1 http://in.archive.ubuntu.com/ubuntu/ wily/main libsctp1 amd64 1.0.16+dfsg-2 [8,414 B]
.
.
.
Setting up lksctp-tools (1.0.16+dfsg-2) ...
Setting up rsplib-docs (3.1.2~rc1.0-1ubuntu1~wily1~ppa0) ...
Setting up rsplib-fgp-cfgfiles (3.1.2~rc1.0-1ubuntu1~wily1~ppa0) ...
Setting up rsplib-legacy-wrappers (3.1.2~rc1.0-1ubuntu1~wily1~ppa0) ...
Setting up rsplib-tools (3.1.2~rc1.0-1ubuntu1~wily1~ppa0) ...
Setting up subnetcalc (2.4.4-1ubuntu1~wily1~ppa0) ...
Setting up traceroute (1:2.0.21-1) ...
update-alternatives: using /usr/bin/traceroute.db to provide /usr/bin/traceroute (traceroute) in auto mode
update-alternatives: using /usr/bin/lft.db to provide /usr/bin/lft (lft) in auto mode
update-alternatives: using /usr/bin/traceproto.db to provide /usr/bin/traceproto (traceproto) in auto mode
update-alternatives: using /usr/sbin/tcptraceroute.db to provide /usr/sbin/tcptraceroute (tcptraceroute) in auto mode
Setting up whois (5.2.10) ...
Processing triggers for libc-bin (2.21-0ubuntu4) ...

Now use the command “ subnetcalc” to calculate subnet mask for any IP Address as follows.

Subnet Calculation for Class C IP address

root@linuxhelp:~# subnetcalc 192.168.5.20/24 
Address       = 192.168.5.20
                   11000000 . 10101000 . 00000101 . 00010100
Network       = 192.168.5.0 / 24
Netmask       = 255.255.255.0
Broadcast     = 192.168.5.255
Wildcard Mask = 0.0.0.255
Hosts Bits    = 8
Max. Hosts    = 254   (2^8 - 2)
Host Range    = { 192.168.5.1 - 192.168.5.254 }
Properties    =
   - 192.168.5.20 is a HOST address in 192.168.5.0/24
   - Class C
   - Private
GeoIP Country = Unknown (??)
DNS Hostname  = (Name or service not known)

Subnet Calculation for Class B IP address

root@linuxhelp:~# subnetcalc 172.25.0.11/16  
Address       = 172.25.0.11
                   10101100 . 00011001 . 00000000 . 00001011
Network       = 172.25.0.0 / 16
Netmask       = 255.255.0.0
Broadcast     = 172.25.255.255
Wildcard Mask = 0.0.255.255
Hosts Bits    = 16
Max. Hosts    = 65534   (2^16 - 2)
Host Range    = { 172.25.0.1 - 172.25.255.254 }
Properties    =
   - 172.25.0.11 is a HOST address in 172.25.0.0/16
   - Class B
   - Private
GeoIP Country = Unknown (??)
DNS Hostname  = (Name or service not known)

Subnet Calculation for Class A IP address

root@linuxhelp:~# subnetcalc 10.20.14.12/8  
Address       = 10.20.14.12
                   00001010 . 00010100 . 00001110 . 00001100
Network       = 10.0.0.0 / 8
Netmask       = 255.0.0.0
Broadcast     = 10.255.255.255
Wildcard Mask = 0.255.255.255
Hosts Bits    = 24
Max. Hosts    = 16777214   (2^24 - 2)
Host Range    = { 10.0.0.1 - 10.255.255.254 }
Properties    =
   - 10.20.14.12 is a HOST address in 10.0.0.0/8
   - Class A
   - Private
GeoIP Country = Unknown (??)
DNS Hostname  = (Name or service not known)
Tag : Subnetcalc
FAQ
Q
How to use Subnetcalc in Ubuntu ?
A
The usage of Subnetcalc in Ubuntu is as follows

#subnetcalc 192.168.5.20/24
Q
what is the required PPA for installing Subnetcalc in Ubuntu?
A
ppa:dreibh/ppa is the required PPA for installing Subnetcalc in Ubuntu
Q
What is Subnetcalc?
A
Subnetcalc is a command line Subnet Address Calculator application. It calculates IPV4 and IPV6 subnet addresses. It provides the information of binary value of IP, broadcast addresses, network
Q
How to install Subnetcalc on fedora?
A
To install Subnetcalc on fedora

Please refer the link as follow "https://fedora.pkgs.org/28/fedora-x86_64/subnetcalc-2.4.3-5.fc28.x86_64.rpm.html"
Q
What is a subnet calculator, and what does it do?
A
A subnet calculator is an online tool that takes a range of IP addresses, or CIDR notation, and generates a list of subnets. You can choose how many subnets you need and adjust certain ranges.