Josh-Daniel S. Davis (joshdavis) wrote,
Josh-Daniel S. Davis

Subnet Masking

I wrote this up earlier in the year (among other times) and thought I should archive it here.

Please note that this example uses 10.x.x.x, which is a non-routable 
block.  This is reserved for everyone to use, and no one may broadcast 
interdomain routes for it.  Typically, if public internet access is needed 
from a 10.* or 192.168.* network, then NAT would be used.

Working with a route like::

The /20 means the first 20 bits are on within this 32-bit mask.  In 
binary, this would be:
        1111 1111    1111 1111    1111 0000    0000 0000

To convert to hex, each 4 bits = 1 nybble.  1 nybble is one hex digit.  2 
nybbles = 1 byte.  This yields a netmask of:
        f f   f f    f 0    0 0

Converted to standard dotted radix 10 (decimal) notation, this would be:

This is also called a dotted quad because it's 4 bytes.

A byte is also called an octed in networking, meaning 8 bits, because some 
systems do not use 8-bit bytes.

Technically, you can represent an IP address as a 32-bit unsigned integer.

So we subtract from is your inverse bit mask

To get the broadcast address from the network address and mask, Add the 
inverse bitmask value to the network address plus yields

Assume you know you're with netmask as above, how would you determine the network and 
Basically, networks don't span outside of thier netmask boundary, so you 
make a table of netmask/broadcasts.

In building your table, start with the supernet (dot-zero for your highest 
variable octet).  In this instance, it would be

So network 1 would be

Add the inverse netmask of to get broadcast number 1

Next network (eg next possible IP address) is

So following the same rules, the next broadcast is

Following this through the whole supernet, The table for 10.0.x.x with netmask of 

Network         Broadcast

For your network, pick the closest previous network address.
In our example, would be within with a netmask of
Tags: creations, networking
  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded