Xem mẫu

  1. 1828xbook.fm Page 329 Thursday, July 26, 2007 3:10 PM Part III: IP Routing Chapter 12 IP Addressing and Subnetting Chapter 13 Operating Cisco Routers Chapter 14 Routing Protocol Concepts and Configuration Chapter 15 Troubleshooting IP Routing
  2. 1828xbook.fm Page 330 Thursday, July 26, 2007 3:10 PM This chapter covers the following subjects: Exam Preparation Tools for Subnetting: This section lists the various tools that can help you practice your subnetting skills. IP Addressing and Routing: This section moves beyond the basic concepts in Chapter 5, “Fundamentals of IP Addressing and Routing,” introducing the purpose and meaning of the subnet mask. Math Operations Used When Subnetting: This section explains how to convert between IP address and subnet mask formats. Analyzing and Choosing Subnet Masks: This section explains the meaning behind subnet masks, how to choose a subnet mask to meet stated design goals, and how to interpret a mask chosen by someone else. Analyzing Existing Subnets: This section shows how to determine an IP address’s resident subnet, broadcast address, and range of addresses in the subnet. Design: Choosing the Subnets of a Classful Network: This section explains how to find all subnets of a single classful network.
  3. 1828xbook.fm Page 331 Thursday, July 26, 2007 3:10 PM 12 CHAPTER IP Addressing and Subnetting The concepts and application of IP addressing and subnetting may well be the most important topics to understand both for being a well-prepared network engineer and for being ready to do well on the ICND1, ICND2, and CCNA exams. To design a new network, engineers must be able to begin with some IP address range and break it into subdivisions called subnets, choosing the right size of each subnet to meet design requirements. Engineers need to understand subnet masks, and how to pick the right masks to implement the designs that were earlier drawn on paper. Even more often, engineers need to understand, operate, and troubleshoot pre-existing networks, tasks that require mastery of addressing and subnetting concepts and the ability to apply those concepts from a different perspective than when designing the network. This chapter begins Part III of the book, which is focused on the role of routers in an internetwork. As introduced in Chapter 5, the network layer defines and uses addressing, routing, and routing protocols to achieve its main goals. After this chapter goes into depth on addressing, the rest of the chapters in Part III focus on how to implement IP addresses, routing, and routing protocols inside Cisco routers. All the topics in this chapter have a common goal, which is to help you understand IP addressing and subnetting. To prepare you for both real jobs and the exams, this chapter goes far beyond the concepts as covered on the exam, preparing you to apply these concepts when designing a network and when you operate and troubleshoot a network. Additionally, this chapter creates a structure from which you can repeatedly practice the math processes used to get the answers to subnetting questions. “Do I Know This Already?” Quiz The “Do I Know This Already?” quiz allows you to assess if you should read the entire chapter. If you miss no more than one of these 14 self-assessment questions, you might want to move ahead to the “Exam Preparation Tasks” section. Table 12-1 lists the major headings in this chapter and the “Do I Know This Already?” quiz questions covering the material in those headings so you can assess your knowledge of these specific areas. The answers to the “Do I Know This Already?” quiz appear in Appendix A.
  4. 1828xbook.fm Page 332 Thursday, July 26, 2007 3:10 PM 332 Chapter 12: IP Addressing and Subnetting “Do I Know This Already?” Foundation Topics Section-to-Question Mapping Table 12-1 Foundation Topics Section Questions Exam Preparation Tools for Subnetting None IP Addressing and Routing 1 Math Operations Used When Subnetting 2, 3 Analyzing and Choosing Subnet Masks 4–8 Analyzing Existing Subnets 9–12 Design: Choosing the Subnets of a Classful Network 13, 14 Which of the following are private IP networks? 1. 172.31.0.0 a. 172.32.0.0 b. 192.168.255.0 c. 192.1.168.0 d. 11.0.0.0 e. Which of the following is the result of a Boolean AND between IP address 2. 150.150.4.100 and mask 255.255.192.0? 1001 0110 1001 0110 0000 0100 0110 0100 a. 1001 0110 1001 0110 0000 0000 0000 0000 b. 1001 0110 1001 0110 0000 0100 0000 0000 c. 1001 0110 0000 0000 0000 0000 0000 0000 d. Which of the following shows the equivalent of subnet mask 255.255.248.0, but in 3. prefix notation? /248 a. /24 b. /28 c. /21 d. /20 e. /23 f.
  5. 1828xbook.fm Page 333 Thursday, July 26, 2007 3:10 PM “Do I Know This Already?” Quiz 333 If mask 255.255.255.128 were used with a Class B network, how many subnets could 4. exist, with how many hosts per subnet, respectively? 256 and 256 a. 254 and 254 b. 62 and 1022 c. 1022 and 62 d. 512 and 126 e. 126 and 510 f. A Class B network needs to be subnetted such that it supports 100 subnets and 100 5. hosts/subnet. For this design, if multiple masks meet those design requirements, the engineer should choose the mask that maximizes the number of hosts per subnet. Which of the following masks meets the design criteria? 255.255.255.0 a. /23 b. /26 c. 255.255.252.0 d. If mask 255.255.255.240 were used with a Class C network, how many subnets could 6. exist, with how many hosts per subnet, respectively? 16 and 16 a. 14 and 14 b. 16 and 14 c. 8 and 32 d. 32 and 8 e. 6 and 30 f. Which of the following subnet masks lets a Class B network have up to 150 hosts per 7. subnet, and supports 164 subnets? 255.0.0.0 a. 255.255.0.0 b. 255.255.255.0 c. 255.255.192.0 d. 255.255.240.0 e. 255.255.252.0 f.
  6. 1828xbook.fm Page 334 Thursday, July 26, 2007 3:10 PM 334 Chapter 12: IP Addressing and Subnetting Which of the following subnet masks let a Class A network have up to 150 hosts per 8. subnet and supports 164 subnets? 255.0.0.0 a. 255.255.0.0 b. 255.255.255.0 c. 255.255.192.0 d. 255.255.252.0 e. 255.255.255.192 f. Which of the following IP addresses are not in the same subnet as 190.4.80.80, mask 9. 255.255.255.0? 190.4.80.1 a. 190.4.80.50 b. 190.4.80.100 c. 190.4.80.200 d. 190.4.90.1 e. 10.1.1.1 f. Which of the following IP addresses is not in the same subnet as 190.4.80.80, mask 10. 255.255.240.0? 190.4.80.1 a. 190.4.80.50 b. 190.4.80.100 c. 190.4.80.200 d. 190.4.90.1 e. 10.1.1.1 f. Which of the following IP addresses are not in the same subnet as 190.4.80.80/25? 11. 190.4.80.1 a. 190.4.80.50 b. 190.4.80.100 c. 190.4.80.200 d. 190.4.90.1 e. 10.1.1.1 f.
  7. 1828xbook.fm Page 335 Thursday, July 26, 2007 3:10 PM “Do I Know This Already?” Quiz 335 Each of the following answers lists a dotted decimal number and a subnet mask. The 12. dotted decimal number might be a valid IP address that can be used by a host or it might be a subnet number or broadcast address. Which of the answers show an address that can be used by a host? 10.0.0.0, 255.0.0.0 a. 192.168.5.160, 255.255.255.192 b. 172.27.27.27, 255.255.255.252 c. 172.20.49.0, 255.255.254.0 d. Which of the following are valid subnet numbers in network 180.1.0.0 when using 13. mask 255.255.248.0? 180.1.2.0 a. 180.1.4.0 b. 180.1.8.0 c. 180.1.16.0 d. 180.1.32.0 e. 180.1.40.0 f. Which of the following are not valid subnet numbers in network 180.1.0.0 when using 14. mask 255.255.255.0? 180.2.2.0 a. 180.1.4.0 b. 180.1.8.0 c. 180.1.16.0 d. 180.1.32.0 e. 180.1.40.0 f.
  8. 1828xbook.fm Page 336 Thursday, July 26, 2007 3:10 PM 336 Chapter 12: IP Addressing and Subnetting Foundation Topics This chapter is fundamentally different from the other chapters in this book. Like the other chapters, this chapter explains a related set of concepts—in this case, the concepts, thought processes, and math used to attack IP addressing and subnetting questions on the CCNA exams. However, more so than for any other chapter in this book, you must practice the concepts and math in this chapter before you take the exam(s). It is very much like math classes in school—if you do not do the homework, you probably will not do as well on the test. This chapter begins with a few comments about how to prepare for subnetting questions on the exam. Then the chapter spends a few pages reviewing what has been covered already in regard to IP addressing and routing, two topics that are tightly linked. The rest of the major sections of the chapter tackle a particular type of subnetting question in depth, with each section ending with a list of suggested steps to take to practice your subnetting skills. Exam Preparation Tools for Subnetting To help you prepare for the exam, this chapter explains the subnetting concepts and shows multiple examples. Each section also lists the specific steps required to solve a particular type of problem. Often, two sets of steps are provided, one that uses binary math, and another that uses only decimal math. More so than for any other single chapter in this book, you should also practice and review the topics in this chapter until you have mastered the concepts. To that end, this book includes several tools, some of which are located on the CD-ROM that comes with this book, in addition to this chapter: Appendix D, “Subnetting Practice”: This large appendix lists numerous practice ■ problems, with solutions that show how to use the processes explained in this chapter. Appendix E, “Subnetting Reference Pages”: This short appendix includes a few ■ handy references, including a 1-page summary of each of the subnetting processes listed in this chapter. Subnetting videos (DVD): Several of the most important subnetting processes ■ described in this chapter are explained in videos on the DVD in the back of this book. The goal of these videos is to ensure that you understand these key processes completely, and hopefully move you quickly to the point of mastering the process. Cisco Binary Game at the Cisco CCNA Prep Center: If you want to use the ■ processes that use binary math, you can use the Cisco Binary Game to practice your
  9. 1828xbook.fm Page 337 Thursday, July 26, 2007 3:10 PM Exam Preparation Tools for Subnetting 337 binary-to-decimal and decimal-to-binary conversion accuracy and speed. The CCNA Prep Center is at http://www.cisco.com/go/prepcenter. The binary game is also included on the CD in the back of the book. Subnetting Game at the Cisco CCNA Prep Center: As of the time of writing this ■ chapter, the CCNA Prep Center had a Beta version of the Subnetting Game available. The game requires that you choose a mask, pick subnets, calculate the subnet number and broadcast address of the subnets, and assign IP addresses in the subnets. Subnetting calculators: You can make up your own practice problems, and use a ■ subnetting calculator to find the answers to check your work. This allows you to have unlimited amounts of practice to get better and get faster. The CCNA Prep Center also has the Cisco Subnet Calculator for free download. Glossary: The topics of IP addressing and subnetting use a wide variety of ■ terminology. The glossary in the back of this book includes the subnetting terms used in this book. Suggested Subnetting Preparation Plan Over the years, some readers have asked for a suggested subnetting study plan. At the same time, the CCNA exam questions have been getting more difficult. To help you better prepare, the following list outlines a suggested study plan: Step 1 If you have not done so already, load the CD-ROM and get familiar with its user interface, install the exam engine software, and verify that you can find the tools listed in the preceding list. You may want to go ahead and print Appendix E, and if you expect you will want to use a printed version of Appendix D, print that as well (be warned, Appendix D is almost 100 pages in length). Step 2 Keep reading this chapter through the end of the second major section, “IP Addressing and Routing.” Step 3 For each subsequent major section, read the section and then follow the instructions in the subsection “Practice Suggestions.” This short part of each major section points you to the items that would be of the most help to stop and practice at that point. These suggestions include the use of the tools listed earlier. The following major sections include a “Practice Suggestions” subsection: • Math Operations Used When Subnetting • Analyzing and Choosing Subnet Masks • Analyzing Existing Subnets • Design: Choosing the Subnets of a Classful Network
  10. 1828xbook.fm Page 338 Thursday, July 26, 2007 3:10 PM 338 Chapter 12: IP Addressing and Subnetting Step 4 When finished with the chapter, if you feel the need for more practice, make up your own practice problems, and check your answers using a subnet calculator (more information is provided after this list). I recommend the Cisco Subnet Calculator because its user interface displays the information in a convenient format for doing extra questions. Step 5 At any point in your study, feel free to visit the CCNA Prep Center (http://www.cisco.com/go/prepcenter) to use both the Cisco Binary Game and the Subnetting Game. Both help you build skills for doing subnetting problems. (The CCNA Prep Center requires you to log in with a Cisco.com User ID; if you do not have one, the preceding URL has a link to Cisco.com registration.) Once in the CCNA Prep Center, you can find the games under the Additional Information tab. You can certainly deviate from this plan to suit your personal preferences, but at the end of this process, you should be able to confidently answer straightforward subnetting questions, such as those in Appendix D. In fact, you should be able to answer in 10–12 seconds a straightforward question such as, “In what subnet does IP address 10.143.254.17, with mask 255.255.224.0, reside?” That is a subjective time period, based on my experience teaching classes, but the point is that you need to understand it all, and practice to the point of being pretty fast. However, perfecting your subnetting math skills is not enough. The exams ask questions that require you to prove you have the skills to attack real-life problems, problems such as how to design an IP network by subnetting a classful network, how to determine all the subnets of a classful network, and how to pick subnets to use in an internetwork design. The wording of the exam problems, in some cases, is similar to that of the math word problems back in school—many people have trouble translating the written words into a math problem that can be worked. Likewise, the exam questions may well present a scenario, and then leave it to you to figure out what subnetting math is required to find the answer. To prepare for these skills-based questions, Chapter 15, “Troubleshooting IP Routing,” covers a wide variety of topics that help you analyze a network to solve subnetting-related problems. These extra tips help you sift through the wording in problems, and tell you how to approach the problems, so that you can then find the answers. So, in addition to this chapter, read through Chapter 15 as well, which includes coverage of tips for troubleshooting IP addressing problems. More Practice Using a Subnet Calculator If you want even more practice, you can essentially get unlimited practice using a subnet calculator. For the purpose of CCNA study, I particularly like the Cisco Subnet Calculator, which can be downloaded from the Cisco CCNA Prep Center. You can then make up your
  11. 1828xbook.fm Page 339 Thursday, July 26, 2007 3:10 PM IP Addressing and Routing 339 own problems like those found in this chapter, work the problem, and then check your work using the calculator. For example, you could pick an IP network and mask. Then, you could find all subnets of that network, using that single mask. To check your work, you could type in the network number and mask in the Cisco Subnet Calculator, and click the Subnets/hosts tab, which then displays all the subnet numbers, from which you can check your answers. As another example, you could pick an IP address and mask, try to find the subnet number, broadcast address, and range of addresses, and then check your work with the calculator using the Subnet tab. After you have typed the IP address and mask, this tab displays the subnet number, broadcast address, and range of usable addresses. And yet another example: You can even choose an IP address and mask, and try to find the number of network, subnet, and host bits—and again check your work with the calculator. In this case, the calculator even uses the same format as this chapter to represent the mask, with N, S, and H for the network, subnet, and host parts of the address. Now that you have a study plan, the next section briefly reviews the core IP addressing and routing concepts covered previously in Chapter 5. Following that, four major sections describe the various details of IP addressing and subnetting. IP Addressing and Routing This section primarily reviews the addressing and routing concepts found in earlier chapters of this book, particularly in Chapter 5. It also briefly introduces IP Version 6 (IPv6) addressing and the concept of private IP networks. IP Addressing Review The vast majority of IP networks today use a version of the IP protocol called IP Version 4 (IPv4). Rather than refer to it as IPv4, most texts, this one included, simply refer to it as IP. This section reviews IPv4 addressing concepts as introduced in Chapter 5. Many different Class A, B, and C networks exist. Table 12-2 summarizes the possible network numbers, the total number of each type, and the number of hosts in each Class A, B, and C network. NOTE In Table 12-2, the “Valid Network Numbers” row shows actual network numbers. There are several reserved cases. For example, network 0.0.0.0 (originally defined for use as a broadcast address) and network 127.0.0.0 (still available for use as the loopback address) are reserved.
  12. 1828xbook.fm Page 340 Thursday, July 26, 2007 3:10 PM 340 Chapter 12: IP Addressing and Subnetting List of All Possible Valid Network Numbers Table 12-2 Class A Class B Class C First Octet Range 1 to 126 128 to 191 192 to 223 Valid Network Numbers 1.0.0.0 to 128.0.0.0 to 192.0.0.0 to 126.0.0.0 191.255.0.0 223.255.255.0 27 – 2 214 221 Number of Networks in This Class 224 – 2 216 – 2 28 – 2 Number of Hosts Per Network Size of Network Part of Address (Bytes) 1 2 3 Size of Host Part of Address (Bytes) 3 2 1 NOTE This chapter uses the term network to refer to a classful network—in other words, a Class A, B, or C network. This chapter also uses the term subnet to refer to smaller parts of a classful network. However, note that many people use these terms more loosely, interchanging the words network and subnet, which is fine for general conversation, but can be problematic when trying to be exact. Figure 12-1 shows the structure of three IP addresses, each from a different network, when no subnetting is used. One address is in a Class A network, one is in a Class B network, and one is in a Class C network. Class A, B, and C IP Addresses and Their Formats Figure 12-1 Network Class A Host (24) (8) . . 8 . 1 4 5 Network (16) Host (16) Class B . . 1 130 100 4 . Class C Network (24) Host (8) . 1 . . 1 1 199 By definition, an IP address that begins with 8 in the first octet is in a Class A network, so the network part of the address is the first byte, or first octet. An address that begins with 130 is in a Class B network. By definition, Class B addresses have a 2-byte network part, as shown. Finally, any address that begins with 199 is in a Class C network, which has
  13. 1828xbook.fm Page 341 Thursday, July 26, 2007 3:10 PM IP Addressing and Routing 341 a 3-byte network part. Also by definition, a Class A address has a 3-byte host part, Class B has a 2-byte host part, and Class C has a 1-byte host part. Humans can simply remember the numbers in Table 12-2 and the concepts in Figure 12-1 and then quickly determine the network and host parts of an IP address. Computers, however, use a mask to define the size of the network and the host parts of an address. The logic behind the mask results in the same conventions of Class A, B, and C networks that you already know, but the computer can deal with it better as a binary math problem. The mask is a 32-bit binary number, usually written in dotted decimal format. The purpose of the mask is to define the structure of an IP address. In short, the mask defines the size of the host part of an IP address, representing the host part of the IP address with binary 0s in the mask. The first part of the mask contains binary 1s, which represents the network part of the addresses (if no subnetting is used), or both the network and subnet parts of the addresses (if subnetting is used). When subnetting is not used, each class of IP address uses the default mask for that class. For example, the default Class A mask ends with 24 bits of binary 0s, which means that the last three octets of the mask are 0s, representing the 3-byte host part of Class A addresses. Table 12-3 summarizes the default masks and reflects the sizes of the two parts of an IP address. Class A, B, and C Networks: Network and Host Parts and Default Masks Table 12-3 Class of Size of Network Part of Size of Host Part of Default Mask for Each Address Address in Bits Address in Bits Class of Network A 8 24 255.0.0.0 B 16 16 255.255.0.0 C 24 8 255.255.255.0 Public and Private Addressing The ICANN (formerly IANA) and its member organizations manage the process of assigning IP network numbers, or even smaller ranges of IP addresses, to companies that want to connect to the Internet. After a company is assigned a range of IP addresses, only that company can use that range. Additionally, the routers in the Internet can then learn routes to reach these networks, so that everyone in the entire Internet can forward packets to that IP network. Because these IP addresses can be reached by packets in the public Internet, these networks are often called public networks, and the addresses in these networks are called public addresses.
  14. 1828xbook.fm Page 342 Thursday, July 26, 2007 3:10 PM 342 Chapter 12: IP Addressing and Subnetting Some computers will never be connected to the Internet. So, engineers building a network consisting of only such computers could use IP addresses that are duplicates of registered public IP addresses in the Internet. So, when designing the IP addressing convention for such a network, an organization could pick and use any network number(s) that it wanted, and all would be well. For instance, you can buy a few routers, connect them together in your office, and configure IP addresses in network 1.0.0.0 and make it work, even though some company also uses Class A network 1 as its registered public IP network. The IP addresses that you use might be duplicates of real IP addresses in the Internet, but if all you want to do is learn on the lab in your office, all is well. However, using the same IP addresses used by another company is unnecessary in this situation, because TCP/IP RFC 1918 defines a set of private networks that can be used for internetworks that do not connect to the Internet. More importantly, this set of private networks will never be assigned by ICANN to any organization for use as registered public network numbers. So, when building a private network, like one in a lab, you can use numbers in a range that is not used by anyone in the public Internet. Table 12-4 shows the private address space defined by RFC 1918. RFC 1918 Private Address Space Table 12-4 Private IP Networks Class of Networks Number of Networks 10.0.0.0 through 10.0.0.0 A 1 172.16.0.0 through 172.31.0.0 B 16 192.168.0.0 through 192.168.255.0 C 256 In other words, any organization can use these network numbers. However, no organization is allowed to advertise these networks using a routing protocol on the Internet. Many of you might be wondering, “Why bother reserving special private network numbers when it does not matter whether the addresses are duplicates?” Well, as it turns out, private networks can be used inside a company and that company can still connect to the Internet today, using a function called Network Address Translation (NAT). Chapter 16, “WAN Concepts,” and Chapter 17, “WAN Configuration,” expand on the concepts of NAT and private addressing, and how the two work together. IP Version 6 Addressing IPv6 defines many improvements over IPv4. However, the primary goal of IPv6 is to significantly increase the number of available IP addresses. To that end, IPv6 uses a 128-bit IP address, rather than the 32 bits defined by IPv4. To appreciate the size of the address structure, a 128-bit address structure provides well over 1038 possible IP addresses. If you
  15. 1828xbook.fm Page 343 Thursday, July 26, 2007 3:10 PM IP Addressing and Routing 343 consider the fact that the Earth currently has less than 1010 people, you can see that you could have literally billions, trillions, or gazillions of IP addresses per person and still not run out. NOTE In case you are wondering, IP Version 5 was defined for experimental reasons but was never deployed. To avoid confusion, the next attempt to update the IP protocol was named IPv6. IPv6 has been defined since the mid-1990s, but the migration from IPv4 to IPv6 has been rather slow. IPv6 was created to solve an overcrowding problem in the IPv4 address space. Some other short-term solutions in IPv4 (notably, NAT, as covered in Chapter 16) helped relieve the IPv4 overcrowding. However, in 2007, IPv6 deployment has started to quicken. Many large service providers have migrated to IPv6 to support the large number of mobile devices that can connect to the Internet, and the U.S. government has mandated migration to IPv6 for its member agencies. The 128-bit IPv6 address is written in hexadecimal notation, with colons between each quartet of symbols. Even in hexadecimal, the addresses can be long. However, IPv6 also allows for abbreviations, as is shown in Table 12-5. The table also summarizes some of the pertinent information comparing IPv4 addresses with IPv6. IPv4 Versus IPv6 Table 12-5 Feature IPv4 IPv6 Size of address (bits or bytes 32 bits, 4 octets 128 bits, 16 octets per octets) Example address 10.1.1.1 0000:0000:0000:0000:FFFF:FFFF:0A01:0101 Same address, abbreviated — ::FFFF:FFFF:0A01:0101 232, (roughly 4 2128, or roughly 3.4 × 1038 Number of possible addresses, ignoring reserved values billion) IP Subnetting Review IP subnetting creates larger numbers of smaller groups of IP addresses compared with simply using Class A, B, and C conventions. You can still think about the Class A, B, and C rules, but now a single Class A, B, or C network can be subdivided into many smaller groups. Subnetting treats a subdivision of a single Class A, B, or C network as if it were a network itself. By doing so, a single Class A, B, or C network can be subdivided into many nonoverlapping subnets.
  16. 1828xbook.fm Page 344 Thursday, July 26, 2007 3:10 PM 344 Chapter 12: IP Addressing and Subnetting Figure 12-2 shows a reminder of the basics of how to subnet a classful network, using the same internetwork shown in Figure 5-6 in Chapter 5. This figure shows Class B network 150.150.0.0, with a need for six subnets. Same Network Topology Using One IP Network with Six Subnets Figure 12-2 150.150.1.0 150.150.2.0 Ray Hannah 150.150.1.1 150.150.2.1 A B S0/0 Fay Jessie 150.150.1.2 150.150.2.2 Frame Relay 150.150.5.0 150.150.5.3 150.150.6.0 C D 150.150.4.0 150.150.3.0 Kris Wendell Vinnie 150.150.4.2 150.150.4.1 150.150.3.1 NOTE The term network might be used to refer to a Class A, B, or C IP network, or might be used to simply refer to a collection of switches, routers, cables, and end-user devices. To avoid confusion, this chapter uses the term internetwork to refer to the collection of networking devices (internetwork meaning “interconnected networks”), and the term network specifically for a Class A, B, or C IP network. This design subnets Class B network 150.150.0.0. The IP network designer has chosen a mask of 255.255.255.0, the last octet of which implies 8 host bits. Because it is a Class B network, there are 16 network bits. Therefore, there are 8 subnet bits, which happen to be bits 17 through 24—in other words, the third octet. NOTE Note that the next major section explains the use and purpose of subnet masks, so do not be concerned at this point if the analysis in this paragraph does not yet make sense.
  17. 1828xbook.fm Page 345 Thursday, July 26, 2007 3:10 PM IP Addressing and Routing 345 The network parts (the first two octets in this example) all begin with 150.150, meaning that each of the six subnets is a subnet of Class B network 150.150.0.0. With subnetting, the third part of an IP address—namely, the subnet part—appears in the middle of the address. This field is created by “stealing” or “borrowing” bits from the host part of the address. The size of the network part of the address never shrinks. In other words, Class A, B, and C rules still apply when you define the size of the network part of an address. However, the host part of the address shrinks to make room for the subnet part of the address. Figure 12-3 shows the format of addresses when subnetting is used. Address Formats When Subnetting Is Used Figure 12-3 8 24 – x x Network Subnet Host Class A 16 16 – x x Network Subnet Host Class B 24 8–x x Network Subnet Host Class C IP Routing Review IP routing and IP addressing were designed with each other in mind. IP routing presumes the structure of IP subnetting, in which ranges of consecutive IP addresses reside in a single subnet. IP addressing RFCs define subnetting so that consecutively numbered IP addresses can be represented as a subnet number (subnet address) and a subnet mask. This allows routers to succinctly list subnets in their routing tables. Routers need a good way to list the subnet number in their routing tables. This information must somehow imply the IP addresses in the subnet. For example, the subnet at the bottom of figure 12-2, which contains host Kris, can be described as follows: All IP addresses that begin with 150.150.4; more specifically, the numbers 150.150.4.0 through 150.150.4.255. Although true, the preceding statement is not very succinct. Instead, a router’s routing table would list the subnet number and subnet mask as follows: 150.150.4.0, 255.255.255.0 The subnet number and mask together means the same thing as the earlier long text statement, but just using numbers. This chapter explains how to examine a subnet number and mask and figure out the range of consecutive IP addresses that comprises the subnet.
  18. 1828xbook.fm Page 346 Thursday, July 26, 2007 3:10 PM 346 Chapter 12: IP Addressing and Subnetting One reason you need to be able to figure out the range of addresses in a subnet is to understand, analyze, and troubleshoot routing problems. To see why, again consider router A’s route for subnet 150.150.4.0, 255.255.255.0 in Figure 12-2. Each route in a router’s routing table lists the destination (a subnet number and mask), plus instructions on how the router should forward packets to that subnet. The forwarding instructions typically include the IP address of the next router to which the packet should be forwarded, and the local router’s interface to use when forwarding the packet. For example, router A’s route to that subnet would look like the information in Table 12-6. Routing Table Entry in Router A Table 12-6 Subnet and Mask Next-hop Router Outgoing Interface 150.150.4.0, 255.255.255.0 150.150.5.3 S0/0 Now, to see how this information is related to subnetting, consider a packet sent by Ray to Kris (150.150.4.2). Ray sends the packet to router A because Ray knows that 150.150.4.2 is in a different subnet, and Ray knows that router A is Ray’s default gateway. Once router A has the packet, it compares the destination IP address (150.150.4.2) to A’s routing table. Router A typically will not find the address 150.150.4.2 in the routing table—instead, the router has a list of subnets (subnet numbers and corresponding subnet masks), like the route listed in Table 12-6. So, the router must ask itself the following: Of the subnets in my routing table, which subnet’s range of IP addresses includes the destination IP address of this packet? In other words, the router must match the packet’s destination address to the correct subnet. In this case, the subnet listed in Table 12-6 includes all addresses that begin with 150.150.4, so the packet destined to Kris (150.150.4.2) matches the route. In this case, router A forwards the packet to router C (150.150.5.3), with router A using its S0/0 interface to forward the packet. NOTE The exams might expect you to apply this knowledge to solve a routing problem. For example, you might be asked to determine why PC1 cannot ping PC2, and the problem is that the second of three routers between PC1 and PC2 does not have a route that matches the destination IP address of PC2. This chapter explains many features of IP addressing and subnetting, as an end to itself. The next section focuses on some basic math tools. The section following that, “Analyzing and Choosing Subnet Masks,” examines the meaning of the subnet mask and how it represents the structure of an IP address—both from a design perspective and the perspective of analyzing an existing internetwork. Following that, the next section, “Analyzing Existing
  19. 1828xbook.fm Page 347 Thursday, July 26, 2007 3:10 PM Math Operations Used When Subnetting 347 Subnets,” explains the processes by which you can analyze an existing IP internetwork, and find the subnet numbers, broadcast addresses, and range of IP addresses in each subnet. Finally, the last section, “Design: Choosing the Subnets of a Classful Network,” explains how to go about designing a subnetting scheme for a Class A, B, or C network, including how to find all possible subnets. Math Operations Used When Subnetting Computers, especially routers, think about IP addresses in terms of 32-bit binary numbers. This is fine, because technically that is what IP addresses are. Also, computers use a subnet mask to define the structure of these binary IP addresses. Acquiring a full understanding of what this means is not too difficult with a little reading and practice. However, getting accustomed to doing the binary math in your head can be challenging, particularly if you do not do it every day. In this section, you will read about three key math operations that will be used throughout the discussion of answering CCNA addressing and subnetting questions: Converting IP addresses and masks from binary to decimal, and decimal to binary ■ Performing a binary math operation called a Boolean AND ■ Converting between two formats for subnet masks: dotted decimal and prefix notation ■ NOTE This chapter includes many summarized processes of how to do some work with IP addresses and subnets. There is no need to memorize the processes. Most people find that after practicing the processes sufficiently to get good and fast enough to do well on the exams, they internalize and memorize the important steps as a side effect of the practice. Converting IP Addresses and Masks from Decimal to Binary and Back Again If you already know how binary works, how binary-to-decimal and decimal-to-binary conversion work, and how to convert IP addresses and masks from decimal to binary and back, skip to the next section, “Performing a Boolean AND Operation.” IP addresses are 32-bit binary numbers written as a series of decimal numbers separated by periods (called dotted decimal format). To examine an address in its true form, binary, you need to convert from decimal to binary. To put a 32-bit binary number in the decimal form that is needed when configuring a router, you need to convert the 32-bit number back to decimal 8 bits at a time.
  20. 1828xbook.fm Page 348 Thursday, July 26, 2007 3:10 PM 348 Chapter 12: IP Addressing and Subnetting One key to the conversion process for IP addresses is remembering these facts: When you convert from one format to the other, each decimal number represents 8 bits. When you convert from decimal to binary, each decimal number converts to an 8-bit number. When you convert from binary to decimal, each set of 8 consecutive bits converts to one decimal number. Consider the conversion of IP address 150.150.2.1 to binary. The number 150, when converted to its 8-bit binary equivalent, is 10010110. (You can refer to the conversion chart in Appendix B, “Decimal to Binary Conversion Table,” to easily convert the numbers.) The next byte, another decimal 150, is converted to 10010110. The third byte, decimal 2, is converted to 00000010. Finally, the fourth byte, decimal 1, is converted to 00000001. The combined series of 8-bit numbers is the 32-bit IP address—in this case, 10010110 10010110 00000010 00000001. If you start with the binary version of the IP address, you first separate it into four sets of eight digits. Then you convert each set of eight binary digits to its decimal equivalent. For example, writing an IP address as follows is correct, but not very useful: 10010110100101100000001000000001 To convert this number to a more-convenient decimal form, first separate it into four sets of eight digits: 10010110 10010110 00000010 00000001 Then look in the conversion chart in Appendix B. You see that the first 8-bit number converts to 150, and so does the second. The third set of 8 bits converts to 2, and the fourth converts to 1, giving you 150.150.2.1. Using the chart in Appendix B makes this much easier, but you will not have the chart at the exam, of course! So, you have two main options. First, you can learn and practice how to do the conversion. This may not be as hard as it might seem at first, particularly if you are willing to practice. The Cisco CCNA Prep Center has a Binary Game that helps you practice the conversions, and its very effective. The second option is to use the decimal- math-only processes listed in this chapter, which removes the need to be good at doing the conversions. However, you do not need to decide right now whether to get really good at doing the conversions—keep reading, understand both methods, and then pick which way works best for you.
nguon tai.lieu . vn