Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Cisco Press CCNA ICND 2004 - Cisco Press.pdf
Скачиваний:
120
Добавлен:
24.05.2014
Размер:
13.19 Mб
Скачать

Analyzing and Interpreting IP Addresses and Subnets 121

Table 4-23 Subnet Chart: 130.4.102.1/255.255.252.0

Octet

1

2

3

4

 

 

 

 

 

Address

130

4

102

1

 

 

 

 

 

Mask

255

255

252

0

 

 

 

 

 

Subnet Number

130

4

100

0

 

 

 

 

 

First Address

130

4

100

1

 

 

 

 

 

Broadcast

130

4

103

255

 

 

 

 

 

Last Address

130

4

103

254

 

 

 

 

 

Table 4-24 Subnet Chart: 199.1.1.100/255.255.255.224

Octet

1

2

3

4

 

 

 

 

 

Address

199

1

1

100

 

 

 

 

 

Mask

255

255

255

224

 

 

 

 

 

Subnet Number

199

1

1

96

 

 

 

 

 

First Address

199

1

1

97

 

 

 

 

 

Broadcast

199

1

1

127

 

 

 

 

 

Last Address

199

1

1

126

 

 

 

 

 

Finding the Answers Without Using Binary

You can derive the subnet number and broadcast addresses without converting to and from binary or performing Boolean math. Using the binary math required to find the subnet number and broadcast address really does help you understand subnetting to some degree. To get the correct answers faster on the exam, you might want to avoid all the conversions and binary math.

If you can find the subnet number and broadcast address, you can easily find the range of valid addresses in the subnet. The easy math described in this section focuses on helping you

find the subnet number and broadcast address.

Easier Math with Easy Masks

Of all the possible subnet masks, three masks, 255.0.0.0, 255.255.0.0, and 255.255.255.0, use only 255s and 0s. I call these “easy” masks because you can find the subnet number and broadcast address easily, without any real math tricks. Perhaps you already know how to find the answers when an easy mask is used. If so, skip to the next section, “Easier Math with Difficult Masks.”

122 Chapter 4: IP Addressing and Subnetting

Of these three easy masks, 255.0.0.0 does not cause any subnetting. Therefore, this section only worries about how to use the two easy masks that can be used for subnetting— 255.255.0.0 and 255.255.255.0.

The process is simple. To find the subnet number when given an IP address and a mask of 255.255.0.0 or 255.255.255.0, do the following:

Step 1 Copy the first two octets (mask 255.255.0.0) or the first three octets (mask 255.255.255.0) from the original IP address.

Step 2 Write down 0s in the last two octets (mask 255.255.0.0) or the last octet (mask 255.255.255.0).

Yep, it’s that easy! Finding the subnet broadcast address is just as easy:

Do the same thing as you did for finding the subnet, but instead of writing down 0s in the last octet or two, write down 255s.

As soon as you know the subnet number and broadcast address, you can easily find the first and last IP addresses in the subnet using the same simple logic covered earlier:

To find the first valid IP address in the subnet, copy the subnet number, but add 1 to the fourth octet.

To find the last valid IP address in the subnet, copy the broadcast address, but subtract 1 from the fourth octet.

Easier Math with Difficult Masks

When the subnet mask is not 255.255.0.0 or 255.255.255.0, I consider the mask to be difficult. Why is it difficult? Well, it is difficult only in that most people cannot easily derive the subnet number and broadcast address without using binary math. You can use the same binary processes in exactly the same way whether the mask is easy or difficult. However, these binary processes take time to do when you cannot use a calculator. So a quicker method of finding the same answers can help.

The following process helps you find the subnet number and broadcast address without binary math when the mask is difficult. (You will find 25 more problems with solutions on the CD chapter “Subnetting Practice: 25 Subnetting Questions.”) This process uses something I call a subnet chart, as shown in Table 4-25.

Analyzing and Interpreting IP Addresses and Subnets 123

Table 4-25 Generic Subnet Chart

Octet

1

2

3

4

Address

Mask

Subnet Number

First Address

Broadcast

Last Address

With the type of question this shortcut helps you answer, the question supplies the address and subnet mask. You simply record the IP address and mask in the table, putting each octet in a different column.

The unusual part of this shortcut begins when you draw a box around the “interesting” octet in the table. I call a mask octet that’s not a 255 or 0 the “interesting” octet because it is the octet that gives everyone heartburn when they first learn subnetting. The box draws attention to the tricky part of the logic used in this shortcut.

For example, consider 130.4.102.1, with mask 255.255.252.0. Because the third octet of the mask is not a 0 or 255, the third octet is where the interesting part of the shortcut takes place. You create a subnet chart, fill in the address and mask, and draw a box around the third octet, as shown in Table 4-26.

Table 4-26 Subnet Chart: 130.4.102.1/255.255.252.0 After Drawing a Box Around the Interesting Octet

Octet

1

2

3

4

 

 

 

 

 

Address

130

4

102

1

 

 

 

 

 

Mask

255

255

252

0

 

 

 

 

 

Subnet Number

 

 

 

 

 

 

 

 

 

First Address

 

 

 

 

 

 

 

 

 

Broadcast

 

 

 

 

 

 

 

 

 

Last Address

 

 

 

 

 

 

 

 

 

Next you complete the chart for everything to the left of the box. To complete the chart, look at the original IP address octets to the left of the box and copy those into the Subnet Number, First Address, Broadcast, and Last Address fields. Note that only octets fully to the left of the box should be copied. The interesting octet, which is inside the box, should not be copied.

Table 4-27 shows the same example after this step.

124 Chapter 4: IP Addressing and Subnetting

Table 4-27 Subnet Chart: 130.4.102.1/255.255.252.0 After Copying Octets to the Left

Octet

1

2

3

4

 

 

 

 

 

Address

130

4

102

1

 

 

 

 

 

Mask

255

255

252

0

 

 

 

 

 

Subnet Number

130

4

 

 

 

 

 

 

 

First Address

130

4

 

 

 

 

 

 

 

Broadcast

130

4

 

 

 

 

 

 

 

Last Address

130

4

 

 

 

 

 

 

 

To find the subnet number, you have a couple of steps. The first step is easy. In the subnet number, for any octets fully to the right of the box, write down a 0. That should leave you with one octet of the subnet number missing—the interesting octet.

Next comes the tricky part of this shortcut, which gives you the value of the subnet number in the interesting octet. First you find what I call the “magic number”—256 minus the mask’s interesting octet. In this case, you have 256 – 252, or a magic number of 4. Then you find the multiple of the magic number that is closest to the address’s interesting octet but less than or equal to it. In this example, 100 is a multiple of the magic number (4 * 25), and this multiple is less than or equal to 102. The next-higher multiple of the magic number, 104, is, of course, more than 102, so that’s not the right number. The multiple of the magic number closest to, but not more than, the address’s interesting octet is the subnet’s interesting octet value. The following items summarize this important step:

Step 1 Find the magic number, which is 256 minus the value of the mask’s interesting octet.

Step 2 Find the multiple of the magic number that is closest to, but not greater than, the address’s interesting octet.

Step 3 Write down that multiple of the magic number as the value of the subnet number’s interesting octet.

In this example, simply plug in 100 for the third octet of the subnet number in Table 4-27.

As soon as you know the subnet number, you can easily find the first valid IP address in the subnet:

To find the first valid IP address in the subnet, copy the subnet number, but add 1 to the fourth octet.

Analyzing and Interpreting IP Addresses and Subnets 125

That’s all! Table 4-28 shows the same example, but with the subnet number and first valid IP address.

Table 4-28 Subnet Chart: 130.4.102.1/255.255.252.0 with Subnet and First IP Address

Octet

1

2

3

4

Comments

 

 

 

 

 

 

Address

130

4

102

1

 

 

 

 

 

 

 

Mask

255

255

252

0

 

 

 

 

 

 

 

Subnet

130

4

100

0

Magic number = 256 – 252 =

Number

 

 

 

 

4. 4 * 25 = 100, the closest

 

 

 

 

 

multiple <= 102.

 

 

 

 

 

 

First Address

130

4

100

1

Add 1 to the subnet’s last

 

 

 

 

 

octet.

 

 

 

 

 

 

Broadcast

130

4

 

 

 

 

 

 

 

 

 

Last Address

130

4

 

 

 

 

 

 

 

 

 

To review, in Table 4-28, the first two octets of the subnet number and the first valid address were already filled in because they are to the left of the box around the third octet—the interesting octet in this case. In the subnet number, the last octet is 0 because it is to the right of the box. To find the interesting octet value, compare the IP address’s interesting octet to find the closest multiple of the magic number that’s not larger, which is 100 in this case. To get the first valid address, just add 1 to the last octet of the subnet number, giving you 130.4.100.1.

The final step in the shortcut finds the broadcast address, from which you can easily find the last valid address in the subnet. First, in the broadcast address, write down a decimal 255 for all octets to the right of the line or the box. Do not write down a 255 in the octet inside the box. Remember, the octets to the left of the box in the subnet chart should already be filled in, leaving a single octet with no value—the interesting octet. To fill in the interesting octet of the broadcast address, you again use the magic number. The magic number is 256 minus the mask’s interesting octet. In this case, you have 256 – 252, or a magic number of 4. Then you add the magic number to the interesting octet value of the subnet number and subtract 1.

The result is the broadcast address’s value in the interesting octet. In this case, the value is

100 + 4 (magic number) – 1 = 103.

126 Chapter 4: IP Addressing and Subnetting

As soon as you know the broadcast address, you can easily find the last valid IP address in the subnet:

To find the last valid IP address in the subnet, copy the broadcast address, but subtract 1 from the fourth octet.

To summarize the tricky part of this shortcut algorithm:

To find the broadcast address’s interesting octet value, take the subnet number’s interesting octet value, add the magic number, and subtract 1.

Table 4-29 shows the completed answers, with annotations.

Table 4-29 Subnet Chart: 130.4.102.1/255.255.252.0 Completed

Octet

1

2

3

4

Comments

 

 

 

 

 

 

Address

130

4

102

1

 

 

 

 

 

 

 

Mask

255

255

252

0

 

 

 

 

 

 

 

Subnet Number

130

4

100

0

Magic number = 256 – 252 = 100. 4 *

 

 

 

 

 

25 = 100, the closest multiple <= 102.

 

 

 

 

 

 

First Address

130

4

100

1

Add 1 to the subnet’s last octet.

 

 

 

 

 

 

Broadcast

130

4

103

255

Subnet-interesting-octet, plus the

 

 

 

 

 

magic number, minus 1 (100 + 4 – 1).

 

 

 

 

 

 

Last Address

130

4

103

254

Subtract 1 from the fourth octet.

 

 

 

 

 

 

The entire process of dissecting IP addresses that use difficult masks is now complete. The following list summarizes the tasks in each step:

Step 1 Create and complete the easy parts of a subnet chart:

(a)Create a generic subnet chart.

(b)Write down the IP address and subnet mask in the first two rows of the chart.

(c)Draw a box around the interesting octet’s column.

(d)Copy the address octets to the left of the line or the box into the final four rows of the chart.

Step 2 Derive the subnet number and the first valid IP address:

(a)Write down 0s in the subnet number for the octets to the right of the box.

(b)Find the magic number, which is 256 minus the value of the mask’s interesting octet.