# Subnetting, a practical approach

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::
10.0.208/20 10.0.223.225

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:
255.255.240.0

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

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
10.0.x.x

So network 1 would be
10.0.0.0

Add the inverse netmask of 0.0.15.255 to get broadcast number 1
10.0.15.255

Next network (eg next possible IP address) is
10.0.16.0

So following the same rules, the next broadcast is
10.0.31.255

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

——————————–
10.0.0.0 10.0.15.255
10.0.16.0 10.0.31.255
10.0.32.0 10.0.47.255
10.0.48.0 10.0.63.255
10.0.64.0 10.0.79.255
10.0.80.0 10.0.95.255
10.0.96.0 10.0.111.255
10.0.112.0 10.0.127.255
10.0.128.0 10.0.143.255
10.0.144.0 10.0.159.255
10.0.160.0 10.0.175.255
10.0.176.0 10.0.191.255
10.0.192.0 10.0.207.255
10.0.208.0 10.0.223.255
10.0.224.0 10.0.239.255
10.0.240.0 10.0.255.255

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.