|  | 10.7 | Creating a Subnet
| 10.7.5 | Boolean AND operation

As you have already learned, the lowest numbered address in an IP network is the network address (the network number plus 0 in the entire host field). This also applies to a subnet; the lowest numbered address is the address of the subnet.

| Lab Activity
| This lab focuses on a Class B network with three subnets. It will help you develop a better understanding of IP subnet mask.

In order to route a data packet, the router must first determine the destination network/subnet address. To accomplish this the router performs a logical AND using the destination host's IP address and the subnet mask for that network.

Imagine that you have a Class B network with the network number 172.16.0.0. After assessing the needs of your network, you decide to borrow 8 bits in order to create subnets. As you learned earlier, when you borrow 8 bits with a Class B network, the subnet mask is 255.255.255.0.

Someone outside the network sends data to the IP address 172.16.2.120. In order to determine where to deliver the data, the router ANDs this address with the subnet mask. When the two numbers are ANDed, the host portion of the result will always be 0. What is left is the network number, including the subnet. Thus, the data is sent to subnet 172.16.2.0, and only the final router notices that the packet should be delivered to host 120 in that subnet.

Now, imagine that you have the same network, 172.16.0.0. This time, however, you decide to borrow only 7 bits for the subnet field. The binary subnet mask for this would be 11111111.11111111.11111110.00000000. What would this be in dotted decimal notation?

Again, someone outside the network sends data to host 172.16.2.120. In order to determine where to send the data, the router again ANDs this address with the subnet mask. As before, when the two numbers are ANDed, the host portion of the result is 0. So what is different in this second example? Everything looks the same - at least in decimal. The difference is in the number of subnets available, and the number of hosts that can be in each subnet. You can only see this by comparing the two different subnet masks.

With 7 bits in the subnet field, there can be only 126 subnets. How many hosts can there be in each subnet? How long is the host field? With 9 bits for host numbers, there can be 510 hosts in each of those 126 subnets.

| Web Links

How Boolean Logic Works

1 The two graphics on this page include something you'll learn more about later - an alternate way to express the subnet mask. You learned that the 1s of the mask represent the routing bits - the network plus the subnet. 255.255.255.0 indicates there are 24 total routing bits. This is sometimes indicated by following an IP address with "/24", as in 131.108.3.1 /24 - this says the same thing as the longer subnet mask.