Calculate network, broadcast, netmask, etc with ipcalc

Posted by Scurz on Tue 3 Jun 2008 at 14:44

Tags: ,

Ipcalc is a simple tool to calculate network, broadcast, netmask, etc. from an IP address. It also gives the class of the IP. It might facilitate the work of network admins. :-)

Here is an example of using it against a "local" IP address:

# ipcalc 192.168.1.1
Address:   192.168.1.1          11000000.10101000.00000001. 00000001
Netmask:   255.255.255.0 = 24   11111111.11111111.11111111. 00000000
Wildcard:  0.0.0.255            00000000.00000000.00000000. 11111111
=>
Network:   192.168.1.0/24       11000000.10101000.00000001. 00000000
HostMin:   192.168.1.1          11000000.10101000.00000001. 00000001
HostMax:   192.168.1.254        11000000.10101000.00000001. 11111110
Broadcast: 192.168.1.255        11000000.10101000.00000001. 11111111
Hosts/Net: 254                   Class C, Private Internet

You may also invoke it with the -h flag to cause the tool to generate HTML output which may be useful for displaying online:

ipcalc -h 192.168.1.1 > mypage.html

To get the ipcalc package installed upon a Debian system simply run "apt-get install ipcalc", or "aptitude install ipcalc".

Further details may be found upon the official project website - don't forget to read the man page, via "man ipcalc" ;-)

 

 


Posted by allan (74.94.xx.xx) on Tue 3 Jun 2008 at 15:38
[ Send Message ]
netmask has similar functionality.

[ Parent | Reply to this comment ]

Posted by stevenothing (84.12.xx.xx) on Tue 3 Jun 2008 at 16:48
[ Send Message ]
If you want something similar for ip6 addresses, grab http://www.nihilistic.org.uk/files/ip6calc.gz

disclaimer: beta, etc. etc. Works for me. ymmv. Let me know if you find a bug.

[ Parent | Reply to this comment ]

Posted by Anonymous (80.177.xx.xx) on Tue 3 Jun 2008 at 17:59
I hadn't seen the ipcalcv6, but may I suggest sipcalc for IPv6 too and that it is in Debian/Main

[ Parent | Reply to this comment ]

Posted by stevenothing (84.12.xx.xx) on Tue 3 Jun 2008 at 18:31
[ Send Message ]
That looks quite nifty. There's also ipv6calc in debian/main too. the ip6calc program linked above was primarily a learning excercise, but it seemed useful enough to let other people grab it, should they want.

[ Parent | Reply to this comment ]

Posted by Anonymous (78.102.xx.xx) on Tue 3 Jun 2008 at 20:12
Go and try `apt-get install sipcalc' to obtain much better tool. Trust me! :-)

[ Parent | Reply to this comment ]

Posted by Anonymous (217.11.xx.xx) on Wed 4 Jun 2008 at 08:35
Yeah, I must definitely agree with this!

[ Parent | Reply to this comment ]

Posted by Anonymous (147.173.xx.xx) on Wed 4 Jun 2008 at 08:34
A Web version is available since a lot of time at http://cric.grenoble.cnrs.fr/reseau/calculemasque/ (in french)

[ Parent | Reply to this comment ]

Posted by Anonymous (217.14.xx.xx) on Wed 4 Jun 2008 at 10:20
Cool! This is typically a tool that I would love to have known about 10 years ago, but always assumed noone had made :-)

[ Parent | Reply to this comment ]

Sign In

Username:

Password:

[Register|Advanced]

 

Flattr

 

Current Poll

Which init system are you using in Debian?






( 1598 votes ~ 7 comments )