Monday, March 13, 2017

network and broadcast address calculation

To simplify that article: network is the lowest possible address in the range of ip addresses left over from the netmask. broadcast is the highest numbered ip address in that range. The "range of ip addresses left over from the netmask" is known as the local network.
"The network" typically means everyone above you, including the Internet. To get to "the network", the network address is used. In reality, most people call "the network" anything with ethernet cables that can talk to each other.
Example: your ISP gives you info to type into a wireless router: a static IP address of and your netmask is Now you're wanting to set up an ubuntu firewall and need to set up your public interface:
Calculate network IP address: -> last octet = E0
 99.  1. 81.209 -> last octet = D1
Logical AND the mask and your ip: 
E0 & D1 = C0 = 192
--> network =

Calculate broadcast address: : E0 -> there are 1F = 31,
-> broadcast = + .31 =
The other way...
Calculate broadcast address: -> last octet = E0
 99.  1. 81.209 -> last octet = D1
Hosts' IPs = 1F 
Logical OR the hosts ips with your ip:
1F | D6 = DF = 223 
--> broadcast =
Often, you'll see networks described with a /. Here's this network: is the netmask, add up the "1" bits:
 8 + 8 + 8 + 3  = 27
so "this network" gets /27 notation
and can be described as
BROADCAST=`ip address show $DEV | grep 'inet .* brd ' | head -1 | sed -e 's/^.* brd \([0-9\.]*\) .*$/\1/'`
dc@dc-Precision-T7600:/etc/network$ echo $BROADCAST


  1. It’s amazing in support of me to have a site, which is useful in support of my know-how. thanks admin, you surely come with remarkable articles. Cheers for sharing your website page.Excellent blog here...
    Digital Marketing Company in Chennai


  2. Its very useful to me. Wonderful blog.. Thanks for sharing informative Post.

    Installment loans
    Payday loans
    Title loans