Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm terrible at working out network subnets in my head. Is there some command line tool for linux (ubuntu packages a plus), that lets me put in and it'll tell me that is a /27?

share|improve this question

5 Answers 5

up vote 19 down vote accepted

ipcalc can do this, for example:

[kbrandt@kbrandt-opadmin: ~] ipcalc                 
Address:          11000000.10101000.00000001. 00000001
Netmask: = 24   11111111.11111111.11111111. 00000000
Wildcard:            00000000.00000000.00000000. 11111111
Network:       11000000.10101000.00000001. 00000000
HostMin:          11000000.10101000.00000001. 00000001
HostMax:        11000000.10101000.00000001. 11111110
Broadcast:        11000000.10101000.00000001. 11111111
Hosts/Net: 254                   Class C, Private Internet

if you entered a subnet mask instead of CIDR, you will still see the /## CIDR number after 'Network:', so it goes both ways.

or with sipcalc:

[kbrandt@kbrandt-opadmin: ~] sipcalc                                                                                             <23403@8:55>
-[ipv4 :] - 0
Host address    	-
Host address (decimal)  - 3232235777
Host address (hex)  - C0A80101
Network address 	-
Network mask    	-
Network mask (bits) - 24
Network mask (hex)  - FFFFFF00
Broadcast address   -
Cisco wildcard  	-
Addresses in network    - 256
Network range   	- -
Usable range    	- -

The Ubuntu Packages are ipcalc and sipcalc:

sudo apt-get install ipcalc
sudo apt-get install sipcalc
share|improve this answer
Interesting output. The ipcalc utility on Fedora (writter by Redhat) is much lamer. –  fpmurphy1 Aug 17 '09 at 19:27

I've used ipcalc before for this. It looks like Ubuntu also has sipcalc. See here.

share|improve this answer

Try either sipcalc or ipcalc.

share|improve this answer

netmask supports automatically figuring out minimal sets of subnets for a particular IP range, which I find to be handy. For example:

# netmask -c
share|improve this answer

I use ipcalc for network subnetting, but it's limited to IPv4 addresses.
you can use subnetcalc, it support both of IPv4 and IPv6.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.