Subnet Mask Overview

 

A sizable Ethernet network can be divided into a number of sub-networks (subnets). These user-defined sub-networks allow unique clusters of Ethernet devices to perform their own communications simultaneously over the same Ethernet wires, independent of the other sub-networks.

 

Each and every device on such a subdivided network is assigned a "subnet mask". The subnet mask you assign will effectively attach that device to a given sub-network. Devices with comparable subnet masks will be able to communicate with one another. Devices with dissimilar subnet masks may only be talked to through a gateway or routing device.

 

If the "masked" bits of two IP addresses are the same, then the two addresses belong to the same subnet.

 

When applying a subnet mask to an IP address, one performs a BITWISE AND operation. The "AND" operation is performed when you apply Boolean algebra to the binary format of both the IP address and the mask. The rules of an "AND" state that, if both digits are "1", the result is one. If either digit is "0", then the result is zero.

 

In our first example we perform an "AND" operation on the local station’s and the destination station #1 using the same subnet mask (255.255.255.240). Notice in figure 1 and figure 2 that this operation results in an address of 208.222.150.0. In the fourth byte of the subnet mask, the four right-most bits (11110000) are not significant because they are all zeros. Therefore, 208.222.150.0, is the result for figure 1 and figure 2 and will be the result when you apply the mask to every address between 208.222.150.0 and 208.222.150.15. From this it can be established that 208.222.150.0 to 208.222.150.15 is the range of IP addresses for one subnet. Notice that both IP addresses from figure 1 and figure 2 fall within this range. We can now conclude that yes, these two IP addresses reside on the same subnet, and thus can communicate with each other without any assistance from a gateway or routing device.

 

In the second example we apply our mask to destination address 208.222.150.18. Notice that the fourth byte for destination IP address #2 (00010010) is different than figure 1 and figure 2. Because of this difference a different result will be derived. Notice how 208.222.150.18, is out of our previous subnet range of 208.222.150.0 to 208.222.150.15. We can conclude that no, this IP address does not reside on the same subnet as figure 1 and figure 2. This IP address must reside on a different subnet because it is not compatible with our subnet mask. Because it does not reside on this subnet, messages for this IP address must be sent to a gateway or routing device to be forwarded until a compatible subnet mask accepts them.

 

 

 

IP

First Byte

Second Byte

Third Byte

Fourth Byte

Subnet Mask

255.255.255.240

11111111

11111111

11111111

11110000

Sending Station’s
IP Address

208.222.150.7

11010000

11011110

10010110

00000111

Result of AND

208.222.150.0

11010000

11011110

10010110

00000000

 

Figure 1

 

 

 

IP

First Byte

Second Byte

Third Byte

Fourth Byte

Subnet Mask

255.255.255.240

11111111

11111111

11111111

11110000

Destination IP Address #1

208.222.150.11

11010000

11011110

10010110

00001011

Result of AND

208.222.150.0

11010000

11011110

10010110

00000000

 

Figure 2

 

 

 

IP

First Byte

Second Byte

Third Byte

Fourth Byte

Subnet Mask

255.255.255.240

11111111

11111111

11111111

11110000

Destination IP Address #2

208.222.150.18

11010000

11011110

10010110

00010010

Result of AND

208.222.150.16

11010000

11011110

10010110

00010000

 

Figure 3