Subnetting Simplified

Quick lesson on configuring subnet addresses.

Bill: I am currently studying for my MCSE but am having a hard time comprehending subnetting. Do you know of any books, articles, etc. I can read on this subject that will explain it in simple terms? Thanks.
—Frank

I feel your pain, Frank. I really do. We sysadmins don't deal with networking every minute of the day like our colleagues in the network group.

Here's one way of looking at the problem. A 32-bit IP address is divided into four 8-bit sections (octets) represented by their decimal equivalent. You can use the Scientific mode of the Windows calculator to determine the binary number for an octet. For example, the address 192.168.0.1 is really this 32-bit number:

11000000  10101000  00000000  00000001

You can do the same calculation on paper. Scribble a quick chart of powers of 2 and their decimal equivalents:

27 26 25 24 23 22 21 20
128 64 32 16 8 4 2 1

Get Help from Bill

Got a Windows or Exchange question or need troubleshooting help? Or maybe you want a better explanation than provided in the manuals? Describe your dilemma in an e-mail to Bill at mailto:boswell@101com.com; the best questions get answered in this column.

When you send your questions, please include your full first and last name, location, certifications (if any) with your message. (If you prefer to remain anonymous, specify this in your message but submit the requested information for verification purposes.)

The top four bits of the top octet determines the network class designation. If the top bit of the top octet is 0, the address is Class A. So, if a stranger comes up to you in the mall and asks the class of the address 83.128.1.37, you'll tell him that 83 is really 64+16+1, which yields binary 01010001, so the first bit is zero and therefore the address is Class A.

The upper octet bits of a Class A address can lie in a range of 00000001 to 01111111, so the Class A address range spans 1 to 64+32+16+8+4+2+0, or 126. (The actual endpoint, 127, is a special case. It's the loopback address, the address that represents the local adapter. It cannot be a network address.)

The standard Class A subnet mask is 255.0.0.0, meaning that all bits in the upper octet determine the network address while the remaining bits in the other three octets determine the host address. So an address of 83.128.1.37 with a subnet mask of 255.0.0.0 has a network address of 83 and a host address of 128.1.37. The binary mask looks like this:

Network Host
01010011 10000000 00000111 00100101
11111111 00000000 00000000 00000000

If the top bit of the first octet is set to 1 and the second bit is set to 0, the address is Class B. This yields a span of 10000000 to 10111111, or 128 to 191.

The default subnet mask for Class B is 255.255.0.0, meaning that the first 16 bits of the address determine the network address. Take an address of 132.15.122.11, for example.

Network Host
10000100 00001111 01111010 00001011
11111111 11111111 00000000 00000000

If the top two bits are set to 1 and the third bit is set to 0, the address is Class C. This yields a span of binary 11000000 11011111 or 192 to 223. The class D address range, 224 (11100000) to 239 (11101111) is used for multicasting. The class E address range starting at 240 (11110000) is not used.

As you know, it is possible to “steal” bits from the host address space in the lower three octets to build a larger network address space for a given address class. For example, a Class C address such as 201.10.10.1 with a subnet mask of 255.255.224 “steals” three bits from the host ID in the final octet. This leaves five bits for host addresses.

Network Host
11001001 00001010 00001010 00000001
11111111 11111111 11111111 11100000

To determine the number of networks and hosts available for a given subnet mask, jot down the power of 2 chart and put in the bits associated with the mask. In the example, 224 represents three bits.

The total of available networks represents the sum of the powers of two in the upper bits of the mask’s final octet. In the example, this is 1+2+4, or 7. The total of available hosts represents the sum of the powers of two in the lower bits of the mask. In the example, this is 1+2+4+8+16 or 31.

You have to do this sort of arithmetic in a lot of different examples to get the hang of it. It’s a little like learning French verbs. For more references, I think Brian Komar does a good job of explaining subnets in his book Teach Yourself TCP/IP Networking in 21 Days (SAMS) and I like the examples you’ll find in Microsoft Windows Server 2003 TCP/IP Protocols and Services Technical Reference by Joseph Davies and Thomas Lee (Microsoft Press).

A Hat in Exchange for Feedback
In response to last week's column, "Finding Users on the Network," Adrian F. DickReiter, MCSE+I, MCSA, of San Antonio, Texas, writes:

Boswell, try using the Psloggedon utility that can be found at http://www.sysinternals.com/ntw2k/freeware/pstools.shtml. With it you type in a username and it systematically goes through all computers on the network to look for a particular user. I've never found a way to capture this data so as to isolate what computers a user is logged onto, but I'm sure there's a way to do it—maybe even something so simple as piping it to a Notepad file might work. It's a really great tool.

Thanks, Adrian. For that advice, we're sending you an MCPmag.com hat!

comments powered by Disqus

Reader Comments:

Sun, Feb 20, 2005 thomas Lee UK

One small point. These days, we tend not to use class-ful addressing. Thus, knowing the difference between a class A vs a class C address may get you a few points in a pub quiz (but only in a pretty nerdy pub!), but its not much good in real life. In real life, we deal with classless addresses, and CIDR. Neveretheless, knowing how to subnet is pretty important!

Thu, Mar 11, 2004 Anonymous Anonymous

Easy to understand

Tue, Oct 7, 2003 Budd CA

The first available host on subnet 32 in 33.

Tue, Sep 30, 2003 Budd CA

Useing the binary format is great but too long to work out in a pinch to determine the Class it is much more easy to remember 0-126 is a Class A and 128- 191 is a Class B and 192-223 is a Class C and then you have 224-239 is a Class D for multicast and 240-249 is Class E for Research. and to remember 127 is for loop back test.

Tue, Sep 30, 2003 Budd CA

Regarding Jim from Toyko. The subnetmask of 224, if you subtract 224 from 256 you get 32. 32 is the base and first subnet, and in order is 32, 64, 96, 128, 160, 192. 224 is not included as it is already being used so you have 6 subnets the first available host on subnet 32 is 31 and 63 is its broadcast, so you only have 30 hosts per subnet.

Tue, Aug 26, 2003 Anonymous Anonymous

I like Jim from Tokyo's explanation the best :0)

Mon, Jul 21, 2003 Jim Verdon Las Vegas

Bill is not very clear on what he means by the top four bits. He should have said"high order bits" like every book worth it's salt talks about. he is just plain wrong on the total number of subnets available and hosts available. Since we can now use the all zeros and all ones subnets you can get 8 total subnets, but only 30 host machines since the hosts still cannot be all zeros nor all ones (in binary). The best book to explain everything is Microsoft Windows 2000 TCP IP PROTOCOLS AND SERVICES, TECHNICAL REFERENCE WRITTEN BY LEE AND DAVIES.

Thu, Jul 17, 2003 Jim Tokyo

Regarding Bill Boswell's final example with a subnet mask of 255.255.255.224. Bill says there are 7 networks available, but actually there are 8. They are .0, .32, .64, .96, .128, .160, .192, .224 and as Dan pointed out, they all have 30 valid host addresses. With 3 bits of the final octet as network bits, do 2^3 (2x2x2)= 8 networks. For the hosts, 5^2-2=30. A handy way to find the # of hosts when the 4th octet is subnetted is to take 256 minus 224 (the 4th octet decimal value) - 2 = 30. Have fun, Jim

Thu, Jul 17, 2003 Anonymous Anonymous

quick and dirty, but too long to write on my arm.

Wed, Jul 16, 2003 Dan Byron SWEDEN

I just want to clarify one thing in the answer from Bill about "The total of available hosts represents the sum of the powers of two in the lower bits of the mask. In the example, this is 1+2+4+8+16 or 31". But the first address is the network address and the last address is the broadcastaddress, so there are only 30 hosts available on the this net. Best regards, Dan

Wed, Jul 16, 2003 Anonymous Anonymous

How I learned subnetting was by going to www.learntosubnet.com. the videos explained well and once through them all, I had it.! Even better that it is free

Wed, Jul 16, 2003 Holger Germany

Bill,

that explanation is good, but there is a little mistake in class A example.
Adress 83.128.1.37
binary must be
01010011 10000000 00000001 00100101
and not
01010011 | 10000000 | 00000111 | 00100101 like you explained.

Best regards
Holger

Add Your Comment Now:

Your Name:(optional)
Your Email:(optional)
Your Location:(optional)
Comment:
Please type the letters/numbers you see above

Redmond Tech Watch

Sign up for our newsletter.

I agree to this site's Privacy Policy.