quinta-feira, fevereiro 07, 2008

IPcalc

Ipcalc is a command-line tool which allows the user to get useful data from a ip and a netmask.

Ipcalc returns the network address, netmask, network address in CIDR notation, min/max IP addresses, broadcast address and the number of hosts of network.

Ipcalc usage is:

Usage: ipcalc [options] 
[[/]] [NETMASK]

A example could be:

$ ipcalc 10.0.0.28 255.255.255.0
Address: 10.0.0.28 00001010.00000000.00000000. 00011100
Netmask: 255.255.255.0 = 24 11111111.11111111.11111111. 00000000
Wildcard: 0.0.0.255 00000000.00000000.00000000. 11111111
=>
Network: 10.0.0.0/24 00001010.00000000.00000000. 00000000
HostMin: 10.0.0.1 00001010.00000000.00000000. 00000001
HostMax: 10.0.0.254 00001010.00000000.00000000. 11111110
Broadcast: 10.0.0.255 00001010.00000000.00000000. 11111111
Hosts/Net: 254 Class A, Private Internet

Ipcalc has been available in Debian at least since v3.1 (’Sarge’) and in Ubuntu since Warty. apt-get install ipcalc will install it for you.