Calculating network and broadcast network addresses with ipcalc


For several years I turned to a CIDR reference or bc to calculate network and broadcast addresses when variable length subnetting was in use. While poking around the /bin directory on one of my CentOS 4.0 servers, I came across the ipcalc utility. This nifty utility allows you to feed it an IP address and prefix, and it will spit out the network and broadcast address associated with that IP address:

$ ipcalc -nb 192.168.1.45/28
BROADCAST=192.168.1.47 NETWORK=192.168.1.32

I love finding buried treasure. :)

This article was posted by Matty on 2006-07-18 21:54:00 -0400 -0400