Please Whitelist This Site?

I know everyone hates ads. But please understand that I am providing premium content for free that takes hundreds of hours of time to research and write. I don't want to go to a pay-only model like some sites, but when more and more people block ads, I end up working for free. And I have a family to support, just like you. :)

If you like The TCP/IP Guide, please consider the download version. It's priced very economically and you can read all of it in a convenient format without ads.

If you want to use this site for free, I'd be grateful if you could add the site to the whitelist for Adblock. To do so, just open the Adblock menu and select "Disable on". Or go to the Tools menu and select "Adblock Plus Preferences...". Then click "Add Filter..." at the bottom, and add this string: "@@||^$document". Then just click OK.

Thanks for your understanding!

Sincerely, Charles Kozierok
Author and Publisher, The TCP/IP Guide

NOTE: Using software to mass-download the site degrades the server and is prohibited.
If you want to read The TCP/IP Guide offline, please consider licensing it. Thank you.

The Book is Here... and Now On Sale!

Read offline with no ads or diagram watermarks!
The TCP/IP Guide

Custom Search

Table Of Contents  The TCP/IP Guide
 9  TCP/IP Lower-Layer (Interface, Internet and Transport) Protocols (OSI Layers 2, 3 and 4)
      9  TCP/IP Internet Layer (OSI Network Layer) Protocols
           9  Internet Protocol (IP/IPv4, IPng/IPv6) and IP-Related Protocols (IP NAT, IPSec, Mobile IP)
                9  Internet Protocol Version 4 (IP, IPv4)
                     9  IP Addressing
                          9  IP Subnet Addressing ("Subnetting") Concepts

Previous Topic/Section
IP Custom Subnet Masks
Previous Page
Pages in Current Topic/Section
Next Page
IP Subnetting Summary Tables For Class A, Class B and Class C Networks
Next Topic/Section

IP Subnet Identifiers, Subnet Addresses and Host Addresses
(Page 2 of 2)

Subnet Address Formulas

Notice when looking at subnet addressing that when you substitute subnet IDs in sequence, a pattern becomes immediately visible. The first subnet address is always the address of the overall network, because the subnet ID is all zeroes. Then, the second subnet address in decimal form is found by adding a specific multiple of two to one of the octets. The third address is then found by adding this same number to the second address, and so on.

In fact, I realized that the decimal value of each subnet address can be expressed as a formula, based on the class of the original network and the number of bits being used for the subnet ID. For example, consider a Class B network with overall address of “x.y.0.0” (it doesn't matter what “x” and “y” are for our purposes). Now, say we are using two bits for the subnet ID. We have four subnet addresses here:

  1. The address of subnet #0 will be the same as the network address: x.y.0.0.

  2. The address of subnet #1 will be found by substituting “01” for the first two bits of the third octet. This yields an address of “x.y.01000000.0000000”, or “x.y.64.0” in straight decimal.

  3. Subnet #2's address is found by substituting “10” for the subnet ID bits, so it is “x.y.10000000.0000000”, or “x.y.128.0” in straight decimal.

  4. Subnet #3's address will be “x.y.192.0”.

So, the formula in this case for subnet #N is “x.y.N*64.0”. If we use five bits for a subnet, the formula is “x.y.N*8.0”; as we saw above, the subnet address for subnet #11 in network is I have shown the formulas for all of the combinations of subnet ID and host ID size in the subnetting summary tables. These formulas may seem a bit confusing at first, but they can be a real time-saver once you become more familiar with subnetting.

Host Addresses Within Each Subnet

Once we know the subnet address for a particular subnet, assigning IP addresses is easy. We just plug in values into the remaining host ID bits. Of course, we skip the all-zeroes value, so the first host in the subnet has all zeroes for the host ID except for a one in the right-most bit position. Then the next host has all zeroes except for “10” at the end (two in decimal). We can do this all the way up to one less than the all-ones value. Again, we then convert each IP address from binary to decimal.

Some more examples would definitely help you understand much better how these addresses are determined. This requires us to deal with a large number of nitty-gritty details and lots of binary numbers. You can find exactly these details in the section on practical subnetting.

Previous Topic/Section
IP Custom Subnet Masks
Previous Page
Pages in Current Topic/Section
Next Page
IP Subnetting Summary Tables For Class A, Class B and Class C Networks
Next Topic/Section

If you find The TCP/IP Guide useful, please consider making a small Paypal donation to help the site, using one of the buttons below. You can also donate a custom amount using the far right button (not less than $1 please, or PayPal gets most/all of your money!) In lieu of a larger donation, you may wish to consider purchasing a download license of The TCP/IP Guide. Thanks for your support!
Donate $2
Donate $5
Donate $10
Donate $20
Donate $30
Donate: $

Home - Table Of Contents - Contact Us

The TCP/IP Guide (
Version 3.0 - Version Date: September 20, 2005

Copyright 2001-2005 Charles M. Kozierok. All Rights Reserved.
Not responsible for any loss resulting from the use of this site.