70-240 in 15 minutes a week: Implementing, Managing, and Troubleshooting Network Protocols and Services Page 6

By ServerWatch Staff (Send Email)
Posted Mar 24, 2001


Let's say that we've been given an address of 156.17.42.6/20, and we're trying to determine the range of valid host IDs on this subnet. The first step is to determine the actual network ID on which this host falls. The process we use to determine this is called ANDing. When we want to AND an IP address and subnet mask, we first convert them to binary and line the subnet mask below the IP address. Then, calculate the AND value. In an AND operation, values are calculated as follows:

1 and 1 = 1
1 and 0 = 0
0 and 0 = 0

In our example, this would give us:
 

IP 10011100 00010001 00101010 00000110
SM 11111111 11111111 11110000 00000000
AND 10011100 00010001 00100000 00000000

After we convert our ANDed address back to decimal we get 156.17.32.0. This is the network ID that our host falls onto.

Stay with me here. We know that our mask is 255.255.240.0 (or /20). So, we know that the last 12 bits represent the hosts on this network. The network bits are in black below, the host bits in red. We already know that a host ID cannot be all zeros or all ones in binary. So, when I'm calculating the range of valid IPs on this subnet/network, I can't have either of these values. This leaves me with: 

Network ID      10011100  00010001  00100000  00000000
First Valid Host ID 10011100  00010001  00100000  00000001
Last Valid Host ID  10011100  00010001  00101111  11111110


Note that the first valid host ID sets all host bits to zero except the last (called the least-significant bit), and the last valid host ID sets all host bits to one, except the last. What did I lose? Two addresses - the host ID being all zeros (which defines the network) and the host ID being all ones (the broadcast address, which is not valid for a host). These are the same 2 addresses that I subtract when trying to find how many hosts I can have per subnet. If I convert my ranges above to decimal, I end up with a range of:

156.17.32.1 to 156.17.47.254 

The truth of the matter is that you won't necessarily have time to 'do the math' for every question that comes at you during the exam, so you'll need a way to quickly determine what ranges of hosts are valid on a subnet given a certain mask. For this purpose, I am providing the chart below. You can use this chart to quickly determine the valid ranges of IP addresses on a subnet based on the mask value, and where the next range starts. Please do not use this chart as a crutch if you don't understand how to determine valid ranges as we went through above. This is meant as a shortcut for those who already understand. 

Mask 128 192 224 240 248 252 254 255
Network ID 128 64 32 16 8 4 2 1

How the chart works is simple. Let's say I've been given a host ID of 167.23.87.13 with a mask of 255.255.248.0, and I want to quickly determine the range of host IP addresses valid on the same subnet as this host. This address is subnetted into the third octet based on the mask, so we take the third octet value (248) and plug it into the chart above. The Network value that corresponds to 248 is 8. As such, that means that every new subnet starts at a multiple of 8 in the third octet. For example:

167.23.0.0 subnet0 range = 167.23.0.1 to 167.23.7.254 *
167.23.8.0 subnet1 range = 167.23.8.1 to 167.23.15.254
167.23.16.0 subnet2 range = 167.23.16.1 to 167.23.23.254
167.23.24.0 subnet 3 range = 167.23.24.1 to 167.23.31.254
167.23.32.0 subnet 4 range = 167.23.32.1 to 167.23.39.254
...
167.23.80.0 subnet10 range = 167.23.80.1 to 167.23.87.254
...
167.23.240.0 subnet30 range = 167.23.240.1 to 167.23.247.254
167.23.248.0 subnet31 range = 167.23.248.1 to 167.23.255.254 *

* Although these ranges were usually omitted in a classful IP addressing system, they are totally valid under CIDR. Often these ranges are still omitted, however, due to the fact that some older equipment may not reference the ranges properly.

Note that our host is on subnet10, the range in red above. The same rules as always still apply, so be careful. The host ID cannot be all 0's or 1's. As another example, if the address had been 17.13.5.1/14, the subnet mask would be 255.252.0.0, making the range of addresses on the same subnet as this host everything on subnet 17.12.0.0, since new ranges start in multiples of 4. That would make the valid range:

17.12.0.1 to 17.15.255.254 

If you go back to the ANDing process, and calculate the first and last host IDs in binary, you'll see that we've come up with the same answer, only much more quickly!

As I mentioned from the outset, this section was not meant to be a complete explanation of designing a subnetting scheme for a network. Instead, we learned how to define valid ranges of addresses based on a host ID and mask value, both in binary and using the shortcut method. For the purpose of 70-240, you will need to be able to troubleshoot IP addressing, and that's what I've focused on above. Once you can calculate valid ranges, you can then determine which host IDs are local and remote, and which hosts are capable of communicating properly. Only hosts that fall into the same range should be on the same subnet. You also now know that the problem may be the address or the subnet mask values of the hosts in question!

Want to practice your subnetting skills? Try my free subnetting practice exams.
Still looking for a short second opinion on subnetting? Click here.
How about a more comprehensive third opinion? Click here.

Wow. Welcome to the end of article 7. I know this has been a longer ride than usual, unless you already understood subnetting - then maybe a little shorter. That does it for the Windows 2000 Profession material. Next week I'll begin with a look at the Windows 2000 Server portion of the exam, topic to be determined. In the meantime, I have a very important announcement to make. I have teamed up with CDI Corporate Education to provide a very valuable free contest. One lucky winner will receive 6 months free unlimited access to the 70-240.com website, which carries a value of approximately $600 US. It includes a whole range of free online courses, practice exams, mentoring, and so forth. Interested in joining the contest? Please visit my website to enter. The prize will be given away on April 16, 2001 - plenty of time to make great use of those 6 months! As always, I look forward to your feedback, so please email me with any questions or comments. In the meantime, good luck with your studies, and good luck in the contest!

Dan
http://www.win2000trainer.com

Page 6 of 6


Comment and Contribute

Your name/nickname

Your email

(Maximum characters: 1200). You have characters left.