This site requires JavaScript for navigation. Please enable JavaScript for the best learning experience.
 

Prerequsite tutorials

To read and understand this tutorial, you will need to understand the following topics

  1. Binary
  2. Binary Masks
  3. IP Addressing
  4. Classful IP Addressing
  5. Classless IP Addressing

Introduction

Every host that has a network interface such as a switch, workstation, server, or router, and that is connected to an Internet Protocol (IP) based network, will have an IP address. Each host that is part of a network will have some part of the beginning of the IP address that is the same as all the other hosts on the network. This part of the address is called the network portion. The other part of an address is the host portion of the address and must be unique.

So how do you determine what part of an IP address is the network portion and what part is the host portion?

THE CLASSFUL ANSWER

Classful addressing breaks up ranges of IP addresses based on the value of the first four bits in the first octet of the IP address. The table below illustrates how the pattern of the first four bits indicates which part of an IP address is the network part and which part of the address is the host part.

N = Network  |  h = Host
First Octet IP Address Characteristics
Most
Significant
BITS
Addr.
Class
Network vs.
Host
NETWORK BITS

HOST BITS

0000 A N.h.h.h 8 24
1000 B N.N.h.h 16 16
1100 C N.N.N.h 24 8

Note that in classful addressing, IP addresses are split into groups of addresses by how many octets are in the host and Network portions of the IP address.

The problem with Classful addressing is that Classful addressing is highly inefficient. When an organization needed just a dozen IP addresses, they were assigned a class C network address block which granted them 256 addresses. This meant that 238 of the addresses went unused and were wasted. As the number of organizations needing addresses grew and the number of IP address blocks dwindled, some means of conserving IP addresses became necessary.

THE CLASSLESS ANSWER

By taking the classful IP address blocks and carving them into smaller blocks, IP addresses could be conserved. This took the class A, class B and Class C networks and carved them into smaller networks. These smaller networks were called sub-networks or just subnets for short. To determine which portion of an address was the network part and which portion was the host part, a mask became necessary to assist computers in determining how many bits in an address were host bits and how many were network bits.

SUBNET MASK

The subnet mask allows a computer to determine what part of an address is network, and which part is host, but does so using binary logic instead of just matching a pattern of 1's and 0's.

To carve a block of addresses into a smaller chunk of addresses, you extend the network portion of the address into the host bits.

The bits in a class C address look like this:

NNNNNNNN.NNNNNNNN.NNNNNNNN.hhhhhhhh

If we carve the class C into 2 blocks, then we need to use one more bit to chop the number of hosts in half.

NNNNNNNN.NNNNNNNN.NNNNNNNN.Nhhhhhhh

To indicate this, we can use a mask that looks like this:

11111111.11111111.11111111.10000000

Yes, the mask always has a 1 for any bit that is supposed to be a network bit in the address. The host bits are always zero.

Why are the network bits in a subnet mask always 1's?

Because routers (which use masks) don't care about host addresses, they care about networks. They want to keep the network part of an address and throw out the host part of the address when they are trying to figure out which network a host belongs to. Thus, the subnet mask serves to help the router keep the network part of the address and ignore the host portion of the address.

Please recall that IP addresses are binary numbers. That means that each column has a value that is twice the value of the column to the right of it. You could also say that each bit has a value that is exactly half the value of the column to the left of it. Thus, carving a block in half only requires moving right one bit. Moving right two bits carves a block into four pieces.




Bookmark this page and SHARE:  

Search

Support InetDaemon.Com

Get Tutorials in your INBOX!

Free Training