Subnetting via TCP/IP Chapter 7

advertisement
4620-1 ch07.f.qc
10/28/99
12:02 PM
Page 265
Chapter 7
Subnetting via TCP/IP
In This Chapter
Learn what subnetting is
Learn what subnetting isn’t
Determine subnetting requirements
Master subnet-related calculations
T
CP/IP, of course, is a study into itself. Mastering the TCP/IP protocol suite
in Windows 2000 Server is much more than understanding what IP
addresses, subnet masks, and default gateways are. Mastering TCP/IP is akin
to mastering mathematics. That is, while you might be hired as a Windows
2000 Server network administrator, having mastered TCP/IP enables you to
be successful when troubleshooting and tackling those network issues that
simply aren’t covered in the books.
Learning the fine art of subnet masking is akin to learning how to operate a
sailboat. What? How can that be? Here’s how. Sailing has best been described
as an endeavor that requires only common sense to be successful. That said,
many of us who sail could improve our skills dramatically if we only
sharpened our common-sense skills. Subnetting is very much the same as
sailing: not terribly difficult, but making heavy use of our common-sense
skills. So here we go!
What Subnetting Is
Subnetting is really the implementation of the divide-and-conquer strategy in
the TCP/IP community. Routers are used to divide, or subnet, networks into
multiple physical segments. So what comprises the conquering part? First on
the list is simplification. Whenever confronted with a tough problem or a
complex area, something that subnetting certainly is, a tried-and-true
troubleshooting strategy is to divide the problem into smaller elements that
you can manage, solve, and conquer, if you will. Thus, by subdividing a large
network into smaller subnets, we conquer the network in our battles, not vice
versa. So why would you do this? There are several benefits to subnetting
including ease of administration, conservation of limited IP addresses, tighter
4620-1 ch07.f.qc
266
10/28/99
12:02 PM
Page 266
Part II: TCP/IP
■
■
and improved security, and more efficient use of networking resources via
traffic management.
Easier administration
Administration potentially is made easier by subnetting because you can
subdivide a large network logically and physically by routers. A clean
network is a happy network. The use of subnetting, properly done, enables
you to organize your networks. And don’t overlook the harsh reality of
corporate politics on your network. Subnetting allows you to divide your
enterprise-wide network along political boundaries. How? Remember that the
complete trust domain model typically was implemented when no one
trusted each other and every little kingdom of users and resources had to be
accommodated. With subnetting, we can create little LANs that reflect
different groupings of users, resources and, in the language of the Windows
2000 Server, objects.
Less confining
Subnetting enables you to make network planning decisions without regard
for the single LAN cable, if you so desire. Whereas many of us old-timers in
the industry traditionally think of a network segment or subnet as a physical
cable run, with subnetting you have the opportunity to think much more
logically. Multiple TCP/IP subnets can exist with ease on a cable segment,
allowing you to divide your network into small networks for reasons known
only to you and God.
Likewise, you also may join unlike IEEE standards and media into a single
subnet using subnetting, so users on a Token Ring network may
communicate with users on an Ethernet network. These users are joined
together on a single, logical IP network using subnetting.
IP address conservation
In other sections of this book, I tout Microsoft Proxy Server as a way to save
precious IP addresses. Properly implemented, IP subnetting enables one real,
or Internet-registered, address to be partitioned into numerous internal
network addresses. Here, the router correctly routes packets between the
external network or Internet and the internal or subnetted network. IP
address conservation should be a fundamental guiding principle in your
Windows 2000 Server network design and planning efforts.
Improved security
Properly implemented, subnetting can improve your network’s security from
external intruders. That’s because, as implied above, the router routes
4620-1 ch07.f.qc
10/28/99
12:02 PM
Page 267
Chapter 7: Subnetting via TCP/IP
267
■
■
between the visible external network and the invisible networks in your
organization. And while we consider justice to be blind in America, in
networking we know that peace is maintained the more that we make our
internal networks invisible to external intruders. But don’t get me wrong.
This security discussion in no way substitutes for a real firewall. It only is
meant to encourage you to think from a secure perspective when considering
the design of your network.
Another name for switching?
What happens if ten WAN engineers get together to create a subnetting plan
for a network? Inevitably, the discussion becomes one of routers versus
switches. Properly implemented, we can direct traffic to its location efficiently
without having to be evaluated by computers all across the network. In effect,
we can use subnetting to create smaller networks that logically are designed
to keep traffic within the neighborhood (see Figure 7-1). We also can use
subnetting to reduce broadcasts in a similar manner.
Subnet 2
204.107.7.XXX
204.107.7.109
Company Network
Subnet 1
204.107.6.XXX
Subnetting can reduce
network traffic congestion
by effectively limiting
certain traffic to one
subnet (dicted packets
and broadcasts)
204.107.6.111
Figure 7-1: Subnetted or smaller networks within the larger network
4620-1 ch07.f.qc
268
10/28/99
12:02 PM
Page 268
Part II: TCP/IP
■
■
Bottom line?
Know thy router when designing a network via subnetting. The router needs
to be told how to distinguish between the host and network addresses. But
more on that in a moment when we get into the details. Remember that
subnetting provides planning and design flexibility and integration
possibilities in ways you may or may not perceive today, but most likely will
appreciate tomorrow.
What Subnetting Isn’t
Subnetting is not some elixir that cures fundamental design errors in your
network. In fact, the use of subnetting in a flawed network may compound
problems, forcing you to return to the basics.
OK, so you subnet your network into several smaller networks. What’s the
downside to that? You’ve allocated a portion of the bit pattern to the network
addresses, thus limiting the quantity of host addresses on each of the smaller
networks. There are only so many bit positions, so if some of the bits are
used to define network subnets, then of course fewer bits are available on
each new subnet to define hosts. Surprisingly, this can be a real limitation on
real-world, enterprise-wide networks.
First, it is essential that you be armed with this dotted decimal notation table
for the different subnet mask classes. Why? You will see in a moment that you
truly drop down to the bit level as you take and subnet an enterprise-wide
network (see Table 7-1).
Table 7-1 Bit View of Default Subnet Masks for Standard IP Address
Classes
Class of Address
Bits
Subnet Mask
Class A
11111111 00000000 00000000 00000000
255.0.0.0
Class B
11111111 11111111 00000000 00000000
255.255.0.0
Class C
11111111 11111111 11111111 00000000
255.255.255.0
Leave it to the router guys and gals to teach me a thing or two in life. These
three classes really are known as the following: Class A is called an eight-bit
mask in the router community, Class B is called a 16-bit mask, and Class C is
called a 24-bit mask. So if you’re speaking with internetworking or router
gurus, be sure to speak the correct form of geek speak!
4620-1 ch07.f.qc
10/28/99
12:02 PM
Page 269
Chapter 7: Subnetting via TCP/IP
269
■
■
Code Breaking 101
So here we go, lower and lower to the bit level. Another view of subnetting is
that of code breaking in the military. When breaking a communication code,
we look for the pattern. Once the pattern is discovered, we can break the
code successfully and decode the communication. As we work through the
low-level details of subnetting, I encourage you to keep this perspective.
First, let’s look at the simple patterns relating to basic subnets. From Table 7-1,
you can see that subnet mask values in each octet position determine whether
the network is operating with a Class A, B, or C license. The subnet mask thus
becomes a decoder for the network to use in separating an IP address into the
Network ID and the Host ID. For example, a Class C subnet mask of 255.255.255.0
and an IP address of 204.107.7.109 suggest a network ID of 204.107.7 and a host
ID of 109. This is known as subnet along a byte boundary. It is what most people
think of when they hear the term subnet or subnetting. In reality, no
“subnetting” is being used.
So far, so good. But what if we want to take our Class C license and further
divide it; that is, engage in “subnetting” along a non-byte boundary? Then,
the exercise becomes more complex.
When subnetting is employed with a Class C scenario, we take advantage of
the fourth octet position of the subnet mask value to communicate some
additional information on the network. As you know, an octet is made up of
eight bits, or one byte, as shown in Figure 7-2.
An "Octet"
1
2
3
4
5
6
7
8
Bit Positions
Figure 7-2: An octet position has eight bits.
Now before I go any further, allow me to share Table 7-2. Based on subnet
“size”, this table provides all-important decimal to binary bit conversion
information. This information is invaluable as we create complex subnetting
scenarios.
4620-1 ch07.f.qc
270
10/28/99
12:02 PM
Page 270
Part II: TCP/IP
■
■
Table 7-2 Subnet Size, Binary Bit Values, Decimal Values
Subnet Size Measured in Bits
Binary Bit Values
Value in Decimal
1
10000000
128
2
11000000
192
3
11100000
224
4
11110000
240
5
11111000
248
6
11111100
252
7
11111110
254
Let’s quickly revisit how binary bit values are converted to decimal.
Remember that with binary, we use a base two counting system (versus a
base 10 counting system used in the “real world”). You may recall with the
binary system, any value up to 255 can be represented as either a one (“1”)
or zero (“0”) within a byte or eight-bit positions. This phenomenon can be
displayed two ways: as a “Power of 2” table (see Table 7-3) or as a simple
chart showing the value of each bit position in a byte (see Table 7-4).
Table 7-3 Powers of 2
Bit Position Within Byte
Power of 2
Decimal Notation Value
00000001
20
1
00000010
21
2
00000100
22
4
00001000
23
8
00010000
24
16
00100000
25
32
01000000
26
64
10000000
27
128
4620-1 ch07.f.qc
10/28/99
12:02 PM
Page 271
271
Chapter 7: Subnetting via TCP/IP
■
■
Table 7-4 Value of Each Bit Position in a Byte
Bit Position
Decimal Value
1
2
3
4
5
6
7
8
128
64
32
16
8
4
2
1
Any questions? Great! Let’s move on. Referring back to Table 7-2, notice
that you can place the decimal value (found in the far-right column) in the
fourth octet position of the Class C subnet mask value to further subnet
my network. Here is what I mean. Remember that the subnet mask
communicates to the network which portion of the IP address to mask as the
subnet number, and thus be default; the host number value is the balance. So
if I present the following subnet mask to the network, the network knows that
the first four bits of the fourth octet are “masked” to communicate subnet
number information. This is perhaps better explained in the following table,
wherein we show the details for the subnet mask 255.255.255.240. Note the
table only shows the details for the fourth octet position. Octet positions
one, two, and three would be populated fully with ones (“1s”) to achieve the
value 255.
Table 7-5 communicates that the first four bit positions are masked out as
part of the subnet number, as these bit positions are occupied with a binary
one value and, most importantly, this information is conveyed in the context
of the subnet mask value (where it is meaningful).
Table 7-5 Subnetting Via “240” in the Fourth Octet Position of Subnet
Mask 255.255.255.240
Bit Position
Decimal Value
Actual Bit Flags
1
2
3
4
5
6
7
8
128
64
32
16
8
4
2
1
1
1
1
1
0
0
0
0
Which leads us to an exercise based on the information presented thus far in
the chapter: With the following information, please determine what the
subnet number and the host number are:
Subnet mask: 255.255.255.240
IP address: 204.131.7.109
Subnet number: _________
Host number: __________
4620-1 ch07.f.qc
272
10/28/99
12:02 PM
Page 272
Part II: TCP/IP
■
■
The solution set is as follows:
1. Understand that subnetting is being used.
2. The fourth octet of the subnet mask has a value of 240. Based on Table
7-5, this can be interpreted to mean that the first four bit positions on the
fourth octet position in the IP address relate to the subnet number; the
final four bit positions relate to the host number.
3. As the IP address has a fourth octet position of 109, we need to break the
code and determine what explicitly relates to the subnet number. This is
accomplished as shown in Table 7-6.
Table 7-6 Bit Breakdown of 109 Value
Bit Position
Decimal Value
Actual Bit Flags
1
2
3
4
5
6
7
8
128
64
32
16
8
4
2
1
0
1
1
0
1
1
0
1
To assist our efforts, I boldfaced the four bit positions of this fourth octet
in the IP address so that it’s easy to determine that the bit positions in
boldface relate to the subnet number. Now, let’s add the boldfaced value
to determine the rest of the subnet number. This is accomplished
in Table 7-7.
Therefore, based on this information, the subnet number is 96.
4. Now the host number is calculated. It is the balance of the bit positions
in the fourth octet position of the IP address 204.131.7.96. This is shown
in Table 7-8.
Table 7-7 Calculating the Subnet Number (First Four Bit Positions) of
the Fourth Octet Position of IP Address 204.131.7.109
Bit Position
Decimal Value
Actual Bit Flags
1
2
3
4
128
64
32
16
0
1
1
0
Subnet Number
96
4620-1 ch07.f.qc
10/28/99
12:02 PM
Page 273
Chapter 7: Subnetting via TCP/IP
■
273
■
Table 7-8 Calculating the Host Number (First Four Bit Positions) of the
Fourth Octet Position of IP Address 204.131.7.109
Bit Position
5
6
7
8
Decimal Value
8
4
2
1
Actual Bit Flags
1
1
0
1
Host Number
13
The solution set is:
■ Subnet number = 96
■ Host number = 13
You can depict this network graphically, as shown in Figure 7-3:
Subnet Mask
255.255.255.240
Network ID: 204.131.7.X
Subnet number -06
IP: 204.131.7.109
Subnet number=96
Host number=13
Figure 7-3: A network with a subnet mask of 255.255.255.240
So if we have a basic understanding of the preceding example, we easily can
interpret the next table, Table 7-9, where the actual bit flags are displayed
for each of the possible subnetting bit values available for a Class C
(255.255.255.x) network. Again, referring to Table 7-2 assists our efforts to
better understand subnetting. The bit portion of the fourth octet position
that relates to the subnet number is in boldface to help in our
comprehension.
Bit1
1
1
1
1
1
1
1
128
0
Subnet mask: 255.255.255.128
Subnet mask: 255.255.255.192
Subnet mask: 255.255.255.224
Subnet mask: 255.255.255.240
Subnet mask: 255.255.255.248
Subnet mask: 255.255.255.252
Subnet mask: 255.255.255.254
Decimal values by bit position
Binary bit representation of 109
1
64
1
1
1
1
1
1
32
1
1
1
1
1
0
0
16
1
1
1
1
0
0
0
Bit 4
1
8
1
1
1
0
0
0
0
Bit 5
1
4
1
1
0
0
0
0
0
Bit 6
0
2
1
0
0
0
0
0
0
Bit 7
1
1
0
0
0
0
0
0
0
Bit 8
This row is presented to
assist in interpreting this
table.
This row is presented to
assist in interpreting this
table.
Subnet number = INVALID
Host number = INVALID
Subnet number = 108
Host number = 1
Subnet number = 104
Host number = 5
Subnet number = 96
Host number = 13
Subnet number = 96
Host number = 13
Subnet number = 64
Host number = 45
Subnet number = 0
(INVALID! We can’t have
zero subnets or a subnet
with a value of zero.
Host number = 109
Evaluation of sample IP
address 204.131.7.109
for each subnetting
example
12:02 PM
1
0
Bit 3
10/28/99
0
Bit 2
274
Description
Table 7-9 Possible Class C Subnetting Values and Impact on
Sample IP Address 204.131.7.109
4620-1 ch07.f.qc
Page 274
■
Part II: TCP/IP
■
4620-1 ch07.f.qc
10/28/99
12:02 PM
Page 275
275
Chapter 7: Subnetting via TCP/IP
■
■
By the way, you may use another technique to convert a decimal value to its
binary bit cousin. This method involves a simple use of division and the
number two. Because the binary counting system is based on a counting
system of “base 2,” it is plausible that you can take any number and divide
by 2 several times to arrive at the binary equivalent. Isn’t it?
Let’s see how a base 2 scenario works. Take the number 109 again — our
sample number.
STEPS:
To convert a decimal value to its binary bit cousin
Step 1. Divide 109 by 2.
109/2 = 54 with a remainder of 1.
Take the remainder as our first bit value, starting with the far right
of our bit listing. Stick with it; you will see the pattern in a
moment.
The cumulative bit order is 1.
Step 2. Divide 54 by 2.
54/2 = 27 with a remainder of 0.
Thus, the bit value is 0.
The cumulative bit order is 01.
Step 3. Divide 27 by 2.
27/2 = 13 with a remainder of 1.
Not surprisingly, the bit value is 1.
The cumulative bit order is 101.
Step 4. Divide 13 by 2.
13/2 = 6 with a remainder of 1.
The bit value is 1.
The cumulative bit order is 1101.
Step 5. Divide 6 by 2.
6/2 = 3 with a remainder of 0.
The bit value is 0.
The cumulative bit order is 01101.
Continued
4620-1 ch07.f.qc
276
10/28/99
12:02 PM
Page 276
Part II: TCP/IP
■
■
STEPS:
To convert a decimal value to its binary bit cousin
(continued)
Step 6. Divide 3 by 2.
3/2 = 1 with a remainder of 1.
The bit value is 1.
The cumulative bit order is 101101.
Step 7. Divide 1 by 2.
1/2 = 0 with a remainder of 1.
The bit value is 1.
The cumulative bit order is 1101101.
Step 8. As the division is complete, we add a zero to the final bit position to
“close” the exercise. The resulting bit order is: 01101101.
Congratulations! You just successfully used another tool for converting a
base 10 number to a base 2 number.
You also may use the built-in calculator in Windows 2000 Server for decimal
and binary bit conversions (and as a tool for subnetting).
The built-in calculator is found under the Accessories area from the Start
button (via Programs). After starting the Calculator, perform the following
steps.
STEPS:
Using the built-in calculator for decimal and binary bit
conversions
Step 1.
Launch the Calculator applet. Convert the calculator from
Standard view to Scientific view (see Figure 7-4). You accomplish
this via the View menu on the Calculator menu bar.
4620-1 ch07.f.qc
10/28/99
12:02 PM
Page 277
277
Chapter 7: Subnetting via TCP/IP
■
■
Figure 7-4: The Scientific view
Step 2.
Type in the decimal value. Use 109 for continuity. Make sure the
“Dec,” or decimal notation radio button, is selected, as shown in
Figure 7-5.
Figure 7-5: Decimal value 109 keyed into the Calculator entry field
Step 3.
Select the “Bin,” or binary notation button, to convert the decimal
value to the binary value of 1101101 (see Figure 7-6). Don’t forget
to add the preceding zero(s) (“0”) when only a partial binary value
is presented.
Continued
4620-1 ch07.f.qc
278
10/28/99
12:02 PM
Page 278
Part II: TCP/IP
■
■
STEPS:
Using the built-in calculator for decimal and binary bit
conversions (continued)
Figure 7-6: The Bin radio button
The Calculator contained within the confines of Windows 2000 Server is truly
a time-saving tool as you implement TCP/IP subnetting on your networks.
And one more take on subnetting so that you are armed completely for your
Windows 2000 Server TCP/IP-related battles. A different tack on subnetting is
to view it from the MCSE perspective. That is, exam cram! A peer from the
industry, John Lambert, shared with readers in Microsoft Certified Professional
Magazine the following points about mastering subnetting from the practical
perspective of just passing the darn TCP/IP certification exam.
Arguably, the TCP/IP elective exam in the MCSE track is the most difficult of
all. This is the exam wherein certification candidates emerge from the testing
room looking like ghosts (or at least with a catatonic gaze). Likewise, I can
say with some degree of certainty that you will encounter the advanced areas
of TCP/IP during your tenure as a Windows 2000 Server professional.
But fear not. It’s really as simple as 1-2-3. That is, the following two charts
serve as your guide to quickly assessing
■ What class a TCP/IP address falls into (refer to Table 7-10)
■ The possible number of subnet numbers and host numbers per
subnetting scenario (see Table 7-11)
4620-1 ch07.f.qc
10/28/99
12:02 PM
Page 279
279
Chapter 7: Subnetting via TCP/IP
■
■
Table 7-10 IP Class Chart
Class
1st Binary Digits
Decimal Range of 1st Octet
A
0
1–126
B
10
128–191
C
110
192–223
Two quick questions to test your understanding of advanced TCP/IP
concepts. The answers follow.
Questions:
1. Why is the decimal value 127 not included in the third column of the
preceding table (Table 7-10)?
2. For the Class C row, why are the first binary digits 110 instead of 11?
Answers:
1. The decimal value 127 can’t be used for network/host IDs, as it is the IP
address area used for loopback testing.
2. IT makes the Class C range end at 223. Remember that initial octet values
ranging between 224–255 are reserved for multicasting, research, and so
on, and may not be used for network/host IDs.
The next table (Table 7-11) is perhaps the most useful of all. At its core, the
table displays the number of subnets and hosts for each subnetting scenario
and IP address. More importantly, it draws out specific relationships that
make you a crack codebreaker... er... subnetter in no time.
Table 7-11 Subnet Mask Chart
Bit Split
Subnet Mask
Max. Usable
Subnets
# C IPs/
Subnet
# B IPs/
Subnet
#A IPs/
Subnet
2/6
192
2
62
16382
4096K
3/5
224
6
30
8190
2048K
4/4
240
14
14
4094
1024K
5/3
248
30
6
2046
512K
6/2
252
62
2
1022
256K
7/1
254
126
0
510
128K
8/0
255
254
0
254
64K
4620-1 ch07.f.qc
10/28/99
280
12:02 PM
Page 280
Part II: TCP/IP
■
■
Here is how you can interpret this chart. First, the bit split is simply the
division of bits between the subnet and the host. This is similar to the
presentation of such a split in Table 7-9, wherein I used boldface to
distinguish among the subnet and host positions.
The subnet mask column shows all possible masks. Remember that zero
appears in some masks, but a zero octet doesn’t mask any bits. As its name
implies, the third column refers to the maximum useable subnets for a given
scenario. Columns four, five, and six speak to the number of usable IP
addresses for each subnet, given an IP address class.
One of the patterns that is important to see is the trade-off between the
number of subnets and hosts as the subnet-related value in the fourth octet
position of the subnet mask increases. Seeing this relationship enables you to
be both a great codebreaker and subnetter!
Summary
This chapter has armed you with the fundamentals of TCP/IP subnetting.
Because Windows 2000 Server relies so much on the TCP/IP protocol suite for
basic local area and wide area network connectivity, it is essential that you
carry forward a deep understanding of the subnetting discussion presented in
this chapter.
Defined TCP/IP subnetting
Performed TCP/IP subnetting calculations
Mastered both the theory and mechanics of TCP/IP subnetting
Download