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 tcpipguide.com". Or go to the Tools menu and select "Adblock Plus Preferences...". Then click "Add Filter..." at the bottom, and add this string: "@@||tcpipguide.com^$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!

The whole site in one document for easy reference!
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 Subnetting: "Three-Level" Hierarchical IP Subnet Addressing
Previous Page
Pages in Current Topic/Section
12
3
4
Next Page
IP Default Subnet Masks For Address Classes A, B and C
Next Topic/Section

IP Subnet Masks, Notation and Subnet Calculations
(Page 3 of 4)

Applying the Subnet Mask: An Example

Now, let's see how the subnet mask might be used. Suppose we have a host on this network with an IP of 154.71.150.42. A router needs to figure out which subnet this address is on. This is done by performing the masking operation shown in Table 50 and Figure 67.


Table 50: Determining the Subnet ID of an IP Address Through Subnet Masking

Component

Octet 1

Octet 2

Octet 3

Octet 4

IP Address

10011010
(154)

01000111
(71)

10010110
(150)

00101010
(42)

Subnet Mask

11111111
(255)

11111111
(255)

11111000
(248)

00000000
(0)

Result of AND Masking

10011010
(154)

01000111
(71)

10010000
(144)

00000000
(0)



Figure 67: Determining the Subnet ID of an IP Address Through Subnet Masking

Subnet masking involves performing a boolean AND between each corresponding bit in the subnet mask and the IP address. The subnet mask can be likened to a physical mask; each 1 in it lets the corresponding bit of the IP address “show through”, while each 0 blocks the corresponding IP address bit. In this way the host ID bits of the address are stripped so the device can determine the subnet to which the address belongs.

 


This result, 154.71.144.0, is the IP address of the subnet to which 154.71.150.42 belongs. There is no need to explicitly differentiate the network ID bits from the subnet ID bits, because we are still using “classful” addresses. Any router can see that since the first two bits of the address are “10”, this is a Class B address. So the network ID is 16 bits, and this means the subnet ID must be bits 17 to 21, counting from the left. Here, the subnet is the portion highlighted above: “10010”, or subnet #18. (I'll explain this better in the section on custom subnetting.)

Key Concept: The subnet mask is often expressed in dotted decimal notation for convenience, but is used by computers as a binary number, and usually must be expressed in binary to understand how the mask works and the number of subnet ID bits it represents.



Previous Topic/Section
IP Subnetting: "Three-Level" Hierarchical IP Subnet Addressing
Previous Page
Pages in Current Topic/Section
12
3
4
Next Page
IP Default Subnet Masks For Address Classes A, B and C
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 (http://www.TCPIPGuide.com)
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.