I was explaining to a guy how subnetting worked. Then I rewrote it and e-mailed it to my sister. She pointed out a typographical error, and now, here is the end result.
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 255.255.250.0 from 255.255.255.255
0.0.15.255 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
10.0.208.0 plus 0.0.15.255 yields 10.0.223.255
Assume you know you’re 10.0.209.47 with netmask as above, how would you determine the network and broadcast addresses?
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 0.0.15.255 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 255.255.240.0 is:
For your network, pick the closest previous network address.
In our example, 10.0.209.47 would be within 10.0.208.0 with a netmask of 10.0.223.25.